Entry
How do I pass a variable from one HTML page to another using the query string of a URL. I don't want to pass a literal but the contents of a variable
May 1st, 2001 13:50
Colin Fraser, Rod Fletcher, comp.lang.javascript
This is actually simple, as long as you get all the right bits in the
right places. I needed to display additional information in a popup
screen for a tutorial, so I created an array of strings, the detail, in
the popup screen to be displayed by script. It was called from the page
by an anchor that looked similar to a traditional Windows help popup,
like this:
<a HREF="javascript:ddef('explanations')"
style="text-decoration:none;color:#009933;font-weight:bold;">explanation
s</a>
This referenced a function called ddef() data definitions that looked
like:
<script type="text/JavaScript" language="JavaScript">
<!--
//Embedded Javascripts placed here
//a function to provide data definitions in popup screens
function ddef(word){
myHelp=window.open('popup1.htm'+'?'+word,'helpWindow','scrollbars=yes,st
atus=no,width=350,height=400,screenx=100,screeny=100,top=100,left=100');
}
-->
</script>
This produces a popup screen of 350px by 400px at about the grid ref
100,100 in both browsers. (BTW this did not work in IE4.x but it does in
IE5.x.) The function sends the variable, word, to the popup1 document
where it is read into an array and a result is displayed. I am pretty
certain I got this from comp.lang.javascript, but I cant be sure.
I hope this answers your question.