HTML Tutorial


 Forum HomeForum Home   FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
RegisterRegister - Not registered yet? Got something to say? Join HTML Code Tutorial!
IE6 Can't load dynamic <script> element's src url
Post new topic   Reply to topic    HTML Help Forum Index -> DHTML
View previous topic :: View next topic  
Author Message
nickyt



Joined: 16 Mar 2005
Posts: 3

PostPosted: Wed Mar 16, 2005 9:48 am     IE6 Can't load dynamic <script> element's src url Reply with quote

The problem I have is not inserting a script tag on the fly, but to get the src attribute to load the given .js file

Here's what I do:
Code:

IFrameReference = a reference to an iframe
doc = IFrameReference.document
head = doc.getElementsByTagName("head")[0]
var scriptOnFly = doc.createElement('script')
scriptOnFly.type = "text.javascript"

// read somewhere that this will help fire the js file in the src attribute,
// however does not seem to do anything
scriptOnFly.text = "void(0)"

scriptOnFly.src = "_scripts/myScript.js"
head.appendChild(scriptOnFly)


So this appends the <script> element to the <head> element and everything looks great, except for the fact that the <script>'s .js file does not load.

This is the way I need to load the script because it's actually another frame that will insert the <script> element on the fly into the frame I need it in.

Things to know:
1. I test if the script loads by putting an alert in myScript.js
2. I've tried appending the <script> element to the <head> and <body>
3. My script does exist and that is it's url
4. I've done the document.write way but it always overwrites my whole document.

Any suggestions or alternative solutions would be greatly appreciated.
nickyt



Joined: 16 Mar 2005
Posts: 3

PostPosted: Thu Mar 17, 2005 6:43 am     Fixed My Problem Reply with quote

Everything in the above code is fine except for the <script>'s src . The url is correct if it is relative to the site that had the frame that injected the scripts onto the page in the other frame. However the page in the other fram is not from the same site.

All I did was put a full reference to the script http://...
Display posts from previous:   
Post new topic   Reply to topic    HTML Help Forum Index -> DHTML All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
HTML Help Archive
Powered by phpBB © 2001, 2005 phpBB Group
HTML Help topic RSS feed 

 
HOSTING / DESIGN
MAKE MONEY

Home
  |   Tutorials   |   Forum   |   Quick List   |   Link Directory   |   About
Copyright ©1997-2002 Idocs and ©2002-2007 HTML Code Tutorial