Topic awaiting preservation: Importing js scripts (Page 1 of 1) |
|
---|---|
Nervous Wreck (II) Inmate From: |
posted 08-23-2002 19:12
I'm wondering if it's possible to dynamically import javascripts. I saw Doc's CSS theme example that changes the href property of the LINK tag to load a different CSS file, and I said to myself it'd be cool if I could do that with the src property of the SCRIPT tag (plus it would be a handy function for this web app I'm developing). I tried it out and it didn't seem to work |
Maniac (V) Mad Scientist From: 100101010011 <-- right about here |
posted 08-23-2002 19:26
You have two choices |
Nervous Wreck (II) Inmate From: |
posted 08-24-2002 00:17
Thanks bit. I actually tried the DOM approach you suggested in the thread, but it did not appear to work. The only differences were I used getElementById to get a reference to the script element and then called removeNode(true), and my script element was a child of the body element, instead of the head element. Should that matter though? code: <script id="targetScript" src=""></script>
|
Maniac (V) Mad Scientist From: 100101010011 <-- right about here |
posted 08-24-2002 07:49
I can't really take credit for that script I got it from bratta at dhtmlcentral. Follow the link and he has a whole tute on how to pull it off |
Nervous Wreck (II) Inmate From: |
posted 08-26-2002 00:00
After messing with it for a while I got it partially working. |
Maniac (V) Lord Mad Scientist Sovereign of all the lands Ozone and just beyond that little green line over there... From: Stockholm, Sweden |
posted 08-26-2002 06:32
I believe that as long as you know the number of the stylesheet, counting from zero at the top, you could just use... |