Re: Send parameter from one HTML page to another?

Martin Honnen wrote:
Petar Popara wrote:

Is it possible to send one parameter from one HTML page to another
HTML page? For example: to send some data as part of the link from
first page:

and second page could receive "mydata" in JavaScript.

You can access various parts of the location object, in the above case
would be the string
which you could then parse e.g.
would give you the mydata string.
If you use the usual query string format to pass data e.g.
then check various script archives for code that parses that query
string, it has been done certainly.

This function returns the ith parameter, starting at parameter 0
function qsobj(parm)
var qpairs ="&")
var qvbl = qpairs[parm].split("=")
return qvbl[1] ? unescape(qvbl[1].replace(/%20|\+/g," ")) : null

I use it like this
<a href = "picture.html?pic=image.jpg&cap=name of

picture.html has this code
<script type="text/javascript">
var pic = qsobj(0)
var cap = qsobj(1)
var height = qsobj(2)
var width = qsobj(3)

Other JS code in picture.html uses the variables

As I understand it, the variable names passed do not have to match the
variable names used when they are retrieved.
That is the call could just as well be
<a href = "picture.html?p=image.jpg&c=name of picture&h=600&w=400">

Trevor L.