[Javascript] Reading a variable from the URL

Tim Lewis twlewis at softhome.net
Tue Jul 17 08:49:27 CDT 2007


Terry, here is a simple example to obtain the URL info:


<html><head>
<title id=onetidTitle>Display Current URL</title>
<script language=JavaScript>
<!--
//
_____________________________________________________________________________
function CurrentURL() {
var sDocumentURL="";
var sDocumentURL = document.URL;
alert ("The current URL is "+sDocumentURL);
return sDocumentURL;
}
//________________________________________________________________
-->
</script></head>
<body>
<form name="Display_Current_URL">
<input id=DisplayURL type=button value="Click to display URL" name=DisplayURL
OnClick="CurrentURL()">
</form>
</body></html>


Tim




> Hello everyone,
>
> I am working on a simple slideshow. The page will be static with
> javascript added for interactivity. I would like to read the URL do
> determine what image is the current image. For example the static
> page is.
>
> /sites/thebrowns/photos/200707/id200707030607.html
>
> It could be called like this...
>
> /sites/thebrowns/photos/200707/id200707030607.html?image=5
>
> Since it is static I would like my javascript to parse the URL and
> set image to 5.
>
>
> Any ideas on how to do this?
>
>
> Thanks for any help.
>
>
> Terry Riegel_______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> https://lists.LaTech.edu/mailman/listinfo/javascript
>





More information about the Javascript mailing list