Hi all,
I've tested the following script on both IE and Firefox and strangely enough IE does what I wanted to happen but Firefox doesn't.
I prefer to use Firefox so I was wondering if someone could explain this small sample code.
the page code:
the 0.js code:
the 1.js code:
and so on...
when testing it in IE it changes the src path of pd1 and alerts "file 1" as I wanted it to.
although testing it in Firefox it does change the src path (as I viewed formatted source) but doesn't execute the alert.
any ideas ?, also which browser is doing the right thing ?,
Thanks for the time.
I've tested the following script on both IE and Firefox and strangely enough IE does what I wanted to happen but Firefox doesn't.
I prefer to use Firefox so I was wondering if someone could explain this small sample code.
the page code:
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"[URL unfurl="true"]http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">[/URL]
<html xmlns="[URL unfurl="true"]http://www.w3.org/1999/xhtml">[/URL]
<head>
<title>Test</title>
</head>
<body>
<script type="text/javascript">
var i=1;var x;
setTimeout("upd()", 3000);
function upd(){
x=document.getElementById('pd1');
x.src="/"+i+".js";
}
</script>
<script type="text/javascript" id="pd1" src="/0.js"></script>
</body>
</html>
the 0.js code:
Code:
alert('file 0');
the 1.js code:
Code:
alert('file 1');
and so on...
when testing it in IE it changes the src path of pd1 and alerts "file 1" as I wanted it to.
although testing it in Firefox it does change the src path (as I viewed formatted source) but doesn't execute the alert.
any ideas ?, also which browser is doing the right thing ?,
Thanks for the time.