[ Home ]

Getting values from the url of a page

You can use the document.URL property to get the text of the url, then look for a pre-defined string to extract the portion you want.

This demonstrates the basic logic required to make it work, but you can probably do it more briefly if you use regular expressions.

See the source code and comments for more detail.

Here are the values of the url variables "one" and "two":