Preserved Topic: Changing script source (Page 1 of 1) |
|
---|---|
Bipolar (III) Inmate From: London, UK |
posted 07-06-2002 04:08
Ok, I haven't much experience in mozilla (or any browser apart from IE), so maybe someone could help me out here. code: <script id="varscript" language="JavaScript" src="script1.js"></script>
code: // In script1.js
code: // In script2.js
code: document.getElementById("varscript").setAttribute("src", "script2.js"); amongst other attempts in mozilla, and while it appears that the src is changed, the function does not become redefined and the script doesn't run. |
Maniac (V) Mad Scientist From: 100101010011 <-- right about here |
posted 07-06-2002 07:50
Ironicly I was just reading about this on DHTMLcentral He uses this technique for dynamically changing data with out using an iframe buffer. |
Paranoid (IV) Inmate From: Sthlm, Sweden |
posted 07-06-2002 11:43
Or simply like this: code: <SCRIPT LANGUAGE="JavaScript">
|
Bipolar (III) Inmate From: London, UK |
posted 07-06-2002 14:21
Thanks bitdamaged - you're a saint! This is exactly what I needed (and for the same reasons). |
Bipolar (III) Inmate From: Berlin (almost) |
posted 07-06-2002 19:52
stinx: bitdamaged's code won't work in Netscape 4.x because it uses DOM funtions which NN 4 doesn't know. |
Paranoid (IV) Inmate From: Dublin, Ireland |
posted 07-12-2002 22:24
I use that method aswell ( document.write(js source file) )with big scripts, what I do is I have function like moveXY() sizeXY() and other things. Each different depending if its IE or gecko (screw NS4, he he or at least with my webpage anyway, the document.write function works in ns, and nothing on my page wont work with NS except some opacity stuff, but Im just that extra bit lazy). |
Lunatic (VI) Mad Scientist From: Massachusetts, USA |
posted 07-12-2002 23:13
Woah, you can do that? Just create a script node/element, and the browser loads the script? |
Maniac (V) Mad Scientist From: 100101010011 <-- right about here |
posted 07-12-2002 23:34
yeppers cool eh? |
Lunatic (VI) Mad Scientist From: Massachusetts, USA |
posted 07-12-2002 23:45
(Remembering, of course, that it would be completely innaccessible to anyone with javascript turned off.) |
Maniac (V) Mad Scientist From: 100101010011 <-- right about here |
posted 07-13-2002 02:11
stupid neandrathals |