Passing A Variable

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • SamMan

    #1

    Passing A Variable

    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


  • Grant Wagner

    #2
    Re: Passing A Variable

    SamMan wrote:
    [color=blue]
    > 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[/color]

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

    or:

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

    --
    | Grant Wagner <gwagner@agrico reunited.com>

    * Client-side Javascript and Netscape 4 DOM Reference available at:
    *


    * 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


    Comment

    Working...