View Full Version : Simple Help with Variables

06-05-2007, 02:25 PM
Hello everybody,

I need some small help with GET Variables in JS.

I'll explain this with an example.

In an HTML file, i have the following code :

<script type="javascript" src="http://anothersite.com/file.js?name=Darkman"></script>

The JS file is as follows :

document.write("The name is '+name+'");

Now, how do i detect and store this "Darkman" in the "name" variable ?


06-05-2007, 04:26 PM
You can't do that with .js file. If the javascript file is a file that has an extension of .asp, .php or any server-side language you are using and has a response type set to "text/javascript", then you can easily retrieve the URL querystring using the server-side language.