By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,636 Members | 1,213 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,636 IT Pros & Developers. It's quick & easy.

Go to web address javascript html

P: 1
HI all Im new to this so forgive my ignorance. so here goes my question I've been researching for a while but havent found what i need.
What Im need is a javascript that will make a form box that the visitor can put a web address in and when they hit the submit button it will take them to the website they entered. the closes i got is this:

<form name='site'>
<input type='text' name='url'/>
<input type='submit' value='Go!' onclick="window.theframe.location=document.site.ur l.value"/>
</form>

but when i try it the addres bar does say "url=www.google.com" but nothing happens. I know im doing somethin wrong i jus was hoping someone out there could help me with that. I can write a script that will take someone to a predetermined website when they hit the button:

<script type="text/javascript">
function locate()
{
location="http://www.google.com/"
}
</script>

</head>
<body>

<form>
<input type="button" onclick="locate()" value="New location">
</form>

</body>

but i am looking for a way where the visitor can choose......now here the catch what i really need is to combine these two concepts so that what the visitor sees it just the form box and the button but what going on in the backround is www.google.com/[ form box here] [go btn] so when they put in lets say "services" it will take what in the script and add /services to the address so they will get pointed to www.google.com/services. so thats what i needed help with. I would really be truly grateful for any help i could get. Thanks in advance...
Oct 2 '05 #1
Share this Question
Share on Google+
1 Reply


P: 3
The correct form of your code is:

<form name='site'>
<input type='text' name='url'/>
<input type='button ' value='Go!' onclick="window.location=document.site.url.value"/>
</form>
Aug 31 '06 #2

Post your reply

Sign in to post your reply or Sign up for a free account.