faqts : Computers : Programming : Languages : JavaScript : Forms

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

25 of 47 people (53%) answered Yes
Recently 4 of 10 people (40%) answered Yes

Entry

How to get the page's url (from the address bar) and submit it by a form?

Apr 24th, 2003 05:42
Russ Locke, Nel MS, Luis Carlos,


to get the url out of the address bar... use:
location.search
then to set it to a hidden input element on your form...
-------------------
id your forms hidden input element which will hold the url address:
<input type='hidden' id='urlAddress' value=''>
then use Javascript to set the form element...
document.getElementById('urlAddress').value = location.search;
either stick this code in the body onload function or
put in a form submit function...