Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

sending and receiving 'location.href;' 1

Status
Not open for further replies.

ralphonzo

Programmer
Apr 9, 2003
228
GB
yes, i'm sure this is deadly basic knowledge to you all, but i'm looking to punch something around now!!

i need to send the 'location.href;' of a page to the next page via a form and i'm damned if i can pick up the javascrpt variable. i've tried hidden fields and onclicks and i'm stumped. can anybody help?
 
Try this:
Code:
<form ... [b]onsubmit="this['referrer'].value=location.href"[/b]>
[b]<input type="hidden" name="referrer" value=""/>[/b]
...
</form>
This will set the value of the field "referrer" (in the current form) to the value of the javascript variable location.href (which is the current URL). It does this just before the form is sent off.

Should do the trick!

Cheers,
Jeff

[tt]Jeff's Blog [!]@[/!] CodeRambler
[/tt]

Make sure your web page and css validates properly against the doctype you have chosen - before you attempt to debug a problem!

FAQ216-6094
 
thanks for helping out a javascript halfwit Jeff. it works a treat now :eek:)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top