Click to See Complete Forum and Search --> : form fields / navigation


paulm
08-02-2003, 08:03 PM
I want two create a navigation system based on a combination of two form fields in this format:

formfield 1 : enter domain (e.g. http://www.domainname.com)
formfield 2 : enter page (e.g. pagename.html)

so then when the form is submitted they can directed to a combination of the two fields to a full url (e.g. http://www.domainname.com/pagename.html)

I got this far using one field but getting the combination to work is proving difficult ( at least with my limited knowledge of javascript)> here my example for one field:

form html:

<form name="form1" action="javascript:get_fullurl()">
<input type="text" name="url">&nbsp;&nbsp;
<input type="text" name="page">
<input type="submit" value="Go">
</form>

script:

function get_fullurl(){
var url = document.form1.url.value;
var stats = document.form1.page.value;
location.replace(url);
}

as you can see I only have the script working for one field at the mo , if anyone help me get the combination working I'd be aprreciative

Thanks .........

Khalid Ali
08-02-2003, 10:10 PM
you need to concatenate both string values from the text fields so that you can make one complete URL

function get_fullurl(){
var url = document.form1.url.value;
var stats = document.form1.page.value;
location.replace(url+stats);
}

paulm
08-03-2003, 07:15 AM
Thanks Khalid ....................

Khalid Ali
08-03-2003, 09:02 AM
:D ....you are welcome