PDA

View Full Version : Reading Variables


WebDude
10-09-2002, 11:15 PM
If I pass the value of a variable to a html page via

http://www.mydomain.com/index.html?variable=value,

how do I read that value with Javascript and make it available in a function?

chrismiceli
10-09-2002, 11:40 PM
it has something to do with the built in javascript function split(), do a search on google.

boywonder
10-09-2002, 11:44 PM
var qString = location.search.substring(1);
will put everything after the '?' into variable qString.

Use split or substring to break up that string and grab what you need.

mordred
10-09-2002, 11:57 PM
Let's advertise beetle's function parseGetVars() that does the work of getting GET variables into your script. You find it here: http://www.codingforums.com/showthread.php?s=&threadid=4555

(alternatively, look at the link in my post at the mentioned thread above, it leads to similar, nearly undistinguishable solution :D)

WebDude
10-10-2002, 12:29 AM
This group is great. Thanks for the help. The Beetle code is what I was looking for. Once I get the variable, I plan to pass it to a Flash movie with:

function PassFlash(){
window.document.movie.SetVariable("variable", "value");
}

Could someone tell me how to form this script so that I can pass the variable and value to my Flash movie?