Passing Data

<HTML>
<BODY>

<!--
If you want it to display info for product1 (defined in "product1" hidden form element below, you need to call the URL: titleofthisdoc.htm?product1
NOTE: You should have a hidden form element called "default_info" defined below in case the specified URL extension is invalid.
-->

<FORM NAME="multi">

<
INPUT
TYPE="hidden"
NAME="default_info"
VALUE=
'<font color="blue" face="Arial,Helvetica" size=+2>
<b>View specs for which product?</b></font>
<ul>
<li><a href="multiurl.htm?product1">Product 1</a>
<li><a href="multiurl.htm?product2">Product 2</a>
</ul>'
>

<
INPUT
TYPE="hidden"
NAME="product1"
VALUE=
'<img src="images/product1.gif" width=147 height=190 align=right>
<font color="blue" face="Arial,Helvetica" size=+2>
<b>Product 1 Name</b></font><br><br>
<b>Product information for Product 1 goes here. Elderly man not included. There are lots of neat things that product 1 can do. Its specs can fill up lots of space. What a great product!!!</b>'
>

<
INPUT
TYPE="hidden"
NAME="product2"
VALUE=
'<img src="images/product2.gif" width=145 height=175 align=right>
<font color="blue" face="Arial,Helvetica" size=+2>
<b>Product 2 Name</b></font><br><br>
<b>Product information for Product 2 goes here. What a great computer it is! There are lots of neat things that product 2 can do. Its specs can fill up lots of space. What a great product!!!</b>'
>

</FORM>

<SCRIPT>

// location.search specifies the query portion of the current URL,
// including the leading question mark.
// For example, multiurl.htm?product1
// the search portion of location would be ?product1

var query = location.search;
var showProd = false; // use this as a flag or switch
var form = document.multi; // creating a shortcut

query = query.substring(1, query.length); // we want to start after the ?

if (query.length > 0) showProd = eval("form." + query);

// write specified product info, remember that the value is the "entire page"
// checkout the various values again to make sure that you understand what they represent
if (showProd) document.write(showProd.value);
else document.write(document.multi.default_info.value); // write default page

</SCRIPT>

</BODY>
</HTML>