# javascript/html help



## Ping898 (Mar 30, 2008)

Ok,  I have hit a stumbling block I can't seem to get around and would appreciate some help.
I am programming in javascript and html.
I pass a bunch of variables on the url:
called.html?a=1&b=2&c=3 ...etc...
when called.html gets loaded I need to take one of the variables off the url and display it in the middle of the page...
kind of like:
XXXXXXXXXXXXXXXXXx
XXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXX
a = <insert value here>
XXXXXXXXXXXx
XXXXXXXXXXXXXX
XXXXXXXXXXXX

So the way I get the variables off the url is by naming the html page is with the FORM tag. and then calling the page by name within the javascript.
but I can't figure out as the page is loading how to call the javascript to grab that variable from the url and then display it where I want to.  The <body onload> isn't working cause I can't get it to work unless I have the javascript outside the first html tag, but if i do that, i don't know how to make it so the scripts can pull the data off the url if I don't use the form tag.  I could use some help.
I know this is terrible programming and completely insecure, but it doesn't matter, it is the interface that matters not the guts of the backend...


----------



## crushing (Mar 30, 2008)

The google terms I used were 'javascript pass variables page'.  I hope these help.

http://www.htmlgoodies.com/beyond/javascript/article.php/3471111

http://www.tek-tips.com/faqs.cfm?fid=5442

Good luck!


----------



## CoryKS (Mar 30, 2008)

Ping898 said:


> but I can't figure out as the page is loading how to call the javascript to grab that variable from the url and then display it where I want to. The <body onload> isn't working cause I can't get it to work unless I have the javascript outside the first html tag, but if i do that, i don't know how to make it so the scripts can pull the data off the url if I don't use the form tag. I could use some help


 
Not sure what you mean by having the javascript outside the first html tag.  Are you referring to the initial <html> tag?  Have you tried placing it within the <head> block?


----------



## Ping898 (Mar 30, 2008)

CoryKS said:


> Not sure what you mean by having the javascript outside the first html tag.  Are you referring to the initial <html> tag?  Have you tried placing it within the <head> block?


yes, doesn't work if I put it in the head block, the onload is called if I have the function located above the <html> tag, but then I can't get to the variables....
I am really trying to figure out if there is someway to make this work without having to call and onload function.


----------



## CoryKS (Mar 30, 2008)

Ping898 said:


> yes, doesn't work if I put it in the head block, the onload is called if I have the function located above the <html> tag, but then I can't get to the variables....
> I am really trying to figure out if there is someway to make this work without having to call and onload function.


 
I see.  The javascript in the first article crushing linked to works pretty well, and doesn't use an onLoad().


----------

