View Full Version : submit button and iframe

05-01-2006, 08:03 PM
hello evrey one, i was hopeing to build a search engine on my site that would search other sites like yahoo , google ,ect.. i've been having one problem with it tho , im trying to get the search results to open in an iframe but all my efforts do this have been in vain , i should mention that im a noob at this , that siad here is the code
this is my .js file (test.js)

function doSearch( selectedIndex, searchTerm ) {
if ( selectedIndex < 0 ) {
alert("Please select a search engine!");
return false;
} else if ( searchTerm == "" ) {
alert("No search term!");
return false;
window.open( SEARCH_DATA[selectedIndex][1] , SEARCH_DATA[selectedIndex][0] );

function engine1( selectedIndex, searchTerm )
SEARCH_DATA= new Array(73);
<!--SEARCH_DATA[value]= new Array( window name , url ) -->
SEARCH_DATA[1]= new Array("yahoo","http://search.yahoo.com/search?p="+escape(searchTerm)+"&sm=Yahoo%21+Search&fr=FP-tab-web-t&toggle=1&cop=&ei=UTF-8");

doSearch( selectedIndex, searchTerm );
return true;
this is the form code

<script language=JavaScript src="test.js" type=text/javascript></script>
<div align="center">
<form name="searchForm1" action="" onSubmit="javascript:engine1(this.engine.options[this.engine.selectedIndex].value,this.go.value); return false;">
<select name="engine" class="drop_down">
<option value="-1" selected>Torrent Search</option>
<option value="1">yahoo</option>

<input name="go" class="text_field" size="20" maxlength="35" />
<input name="submit" type="submit" class="search_button" value="Search" />
this is my iframe statment

<iframe id="inpage" style="width:600px;height:400px" src="http://www.google.com"></iframe>
im trying to set it up so that when the search button is clicked it would open the search results in the iframe. any comments will be appreciated and thanx in advance:D