Passing A Variable

S

SamMan

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
 
G

Grant Wagner

SamMan said:
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 <[email protected]>

* Client-side Javascript and Netscape 4 DOM Reference available at:
*
http://devedge.netscape.com/library/manuals/2000/javascript/1.3/reference/frames.html

* Internet Explorer DOM Reference available at:
*
http://msdn.microsoft.com/workshop/author/dhtml/reference/dhtml_reference_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-developer/upgrade_2.html
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top