homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

Need document.write('<SCR' + 'IPT>') Help
How do you pass variables to the external script?

10+ Year Member

Msg#: 3127 posted 9:05 pm on Feb 3, 2005 (gmt 0)

OK, so you have this in a test.js file:

document.write("<SCR" + "IPT TYPE=\"text/javascript\" SRC=\"whatever.js\"><\/SCR" + "IPT>

How do I send javascript variables from test.js to whatever.js?

Normally, one could have a script section before calling the script calling the external file, but I can't seem to get that to work.

In other words, how can I pass variables calculated in test.js to the external script whatever.js?


Bernard Marx

WebmasterWorld Senior Member 10+ Year Member

Msg#: 3127 posted 12:53 am on Feb 4, 2005 (gmt 0)

You don't need to pass anything. They both merge into one big script.

Any variables defined in the script before the doc.write() can be used in the 'imported' part of the script.

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved