...

View Full Version : Search bar - link form



hardwarebuddy
01-23-2007, 04:41 PM
Hey
I'm a newbie to the art of coding but I want to code a form box into a search box type thing. The closest I've found to the link box I want is this:
<form action="#">
Type in a URL, and hit the Go! button to go there!
<br />
<input name="the_url" type="text" value="http://" size="25" />
&nbsp;&nbsp;
<input type="button" value="Go!" onClick="window.location=this.form.the_url.value" />
</form>


What I want my search bar/link bar is that when you type in say "joe" i want it to go to page ../joe.htm (I'm using microsoft frontpage btw). Is there anyway I can code that somehow? Any help would be great. Thank you in advance :)!

_Aerospace_Eng_
01-23-2007, 10:53 PM
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>&nbsp;</title>
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<script type="text/javascript">
function searchIt()
{
var yoursite = 'http://www.yoursite.com/';
var suffix = '.htm';
window.location = yoursite + document.forms[0].goto.value + suffix;
return false;
}
</script>
</head>
<body>
<form action="#" method="post" onsubmit="return searchIt()">
<input type="text" name="goto" value="Enter Page Name Here" onfocus="if(this.value == this.defaultValue) this.value = ''" onblur="if(this.value == '') this.value = this.defaultValue">
<input type="submit" value="Submit">
</form>
</body>
</html>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum