By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,380 Members | 1,615 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,380 IT Pros & Developers. It's quick & easy.

Passing A Variable

P: n/a
I have a simple (I hope) question.
Is it possible to pass a variable from a .js file to an .html file? A value
is passed to the variable through a function, and I'd like to pass that
variable on to an .html page.

Thanks,
Sam
Jul 20 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
SamMan wrote:
I have a simple (I hope) question.
Is it possible to pass a variable from a .js file to an .html file? A value
is passed to the variable through a function, and I'd like to pass that
variable on to an .html page.

Thanks,
Sam


window.location.href = 'somepage.html?yourVariable=' + escape(yourVariable);

or:

document.write('<a href="somepage.html?yourVariable=' +
escape(yourVariable) + '">A link</a>');

--
| Grant Wagner <gw*****@agricoreunited.com>

* Client-side Javascript and Netscape 4 DOM Reference available at:
*
http://devedge.netscape.com/library/...ce/frames.html

* Internet Explorer DOM Reference available at:
*
http://msdn.microsoft.com/workshop/a...ence_entry.asp

* Netscape 6/7 DOM Reference available at:
* http://www.mozilla.org/docs/dom/domref/
* Tips for upgrading JavaScript for Netscape 6/7 and Mozilla
* http://www.mozilla.org/docs/web-deve...upgrade_2.html
Jul 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.