<script
language="Javascript">
form.action
=
getVarFromURL(window.location.href,
'loginurl');
</script>
<INPUT
type="text"
name="myusername"
size="25">
<INPUT
type="password"
name="mypassword"
size="25">
<INPUT
name="button_submit"
type="submit"
value="Enter">
<INPUT
name="button_clear"
type="button"
value="Clear">
</FORM>
The
following
shows
the
corresponding
self
‐
defined
javascript
function
used
to
parse
the
loginurl
parameter:
function
getVarFromURL(url,
name)
{
if(name
==
""
||
url
==
"")
{
return
"";
}
name
=
name.replace(/[\[]/|"\\\[").replace(/[\]]/|"\\\]");
var
regObj
=
new
RegExp("[\\?&]"+name+"=([^&#]*)");
var
result
=
regObj.exec(url);
if(result
==
null)
{
return
"";
}
else
{
return
decodeURIComponent(result[1]);
}
}
142