views:

25

answers:

0

how can i make a form tag using onsubmit (that executes upon hitting enter) which opens a target window with a given url in a string variable form?

what i have so far:

<div id="row2">

 <!-- Intranet Search -->
 <form action="" onSubmit="urlGen(this);" method="get" target="_blank">
 <input type="text" name="intranet" id="intranet" size="15" value="Search Intranet.."
  onFocus="this.value = ''"
  onBlur="this.value = 'Search Intranet..'" / > 
 </form>

 <script language="javascript" type="text/javascript">
  function urlGen(f)
   {
    var i1 = "seg1";
    var i2 = f.intranet.value;
    var i3 = "seg3";

    var fullURL = i1 + i2 + i3;
    f.action = i1 + i2 + i3;

    //document.write(fullURL);

    return true;
   }
 </script>

<br><br>

 <a href="javascript: void(0)" onClick="urlGen();" target="_blank">
  <div id="submit" class="out"
   onMouseOver="document.getElementById('submit').className = 'over';"
   onMouseOut="document.getElementById('submit').className = 'out';">
   <span>Submit</span>
  </div>
 </a>