A Possible Answer

Search Webcrawler for:

Once you know the address of the search engine, then it should be fairly easy. But how do you get it? All I did was go to a search engine, do a search and copy the address from the Location bar. Ta Da!

Since you want the alert to pop up before the search occurs, make sure it's first in the run. Here's the script that did it:



<SCRIPT type="text/javascript">

function Gofindit(){

alert("Going to Search...");
  var searchfor = document.formsearch.findthis.value;    
{                                
  var FullSearchUrl = 
    "http://webcrawler.com/cgi-bin/WebQuery?
	searchText=" + searchfor ;
location.href = FullSearchUrl;
}}



</script>



<form name="formsearch">
<b>Search Webcrawler for:</b> 
  <input  name="findthis" type="text">
<input type="button" 
  value="Go Find It" onClick="Gofindit()">
</form>

Close this window to return to JavaScript Primer