Hello,
I want to replace already loaded java script files. So, I find interesting example from Internet that can help me. This example work on IE, but fail on Firefox. Why?
Any idea?
Below are the files from the example.
Greetings!
////test.htm////
<html><head><title>example</title>
<script type="text/javascript" src="test1.
js">
</script>
<script type="text/javascript">
function swapJS(thelink)
{
document.getElementsByTagName('script')[0].src=thelink;
// document.getElementsByTagName('script')[0].setAttribute("src", thelink); //this row is the same
}
</script>
</head>
<body>
<a href="#" onmousedown="swapJS('test1.
js');alertit()">Load JavaScript file One</a>
<br><br>
<a href="#" onmousedown="swapJS('test2.
js');alertit()">Load JavaScript file Two</a>
</body>
</html>
///test1.
js///
function alertit() {alert("this is
js file one");}
///test2.
js///
function alertit() {alert("this is
js file two");}