lunedì, ottobre 15, 2007

Simple JavaScript: window.location

Basic stuff, but mighty useful for a novice such as myself. window.location is an object containing:

 

Properties

hash

host

hostname

href

pathname (relative to the host)

port

protocol

search

 

Methods

assign(url)

reload(forceget)

replace(url)

toString()

 

Example:

<SCRIPT LANGUAGE="JavaScript">

<!--

      {

document.write(location.href);

document.write(location.hostname);

      }

      // -->

</SCRIPT>