id like to have an input box that a user can enter a search term into that gets passed to maybe a javascript function that then combines some url segments with the search term creating a full url. up until now its been working fine without a form around it, but i would like to add a form to it so users can just hit enter rather than clicking a submit button.
submit button code:
<a href="javascript: void(0)" onClick="this.href = i1 + document.getElementById('intranet').value + i3" target="_blank">
<div id="submit" class="out"
onMouseOver="document.getElementById('submit').className = 'over';"
onMouseOut="document.getElementById('submit').className = 'out';">
<span>Submit</span>
</div>
</a>
faulty form/input code:
<form action="" onSubmit="this.href = i1 + document.getElementById('intranet').value + i3; return false;" method="get" target="_blank">
<input type="text" id="intranet" size="15" value="Search Intranet.."
onFocus="document.getElementById('intranet').value = ''"
onBlur="document.getElementById('intranet').value = 'Search Intranet..'" / >
</form>
possible js function to create url:
<script language="javascript" type="text/javascript">
function urlGen(value)
{
var i1 = "seg1";
var i2 = document.getElementById('intranet').value;
var i3 = "seg2";
var fullURL = i1 + document.getElementById('intranet').value + i3;
return fullURL;
}
</script>