How do I make a JavaScript Source work in frames
Hi everyone,
I just downloaded the The JavaScript Source: Forms: Multiple Search Engine for my site. However, I’m using frames and I need the results from the form to show in the mainFrame of my page. Can anyone help me?
Thank you
Leo
here is the code:
<!– TWO STEPS TO INSTALL MULTIPLE SEARCH ENGINE:
1.
Add the onLoad event handler into the BODY tag
Copy the coding into the BODY of your HTML document –>
<!– STEP ONE: Insert the onLoad event handler into your BODY tag –>
<BODY onLoad=”addOptions()”>
<!– STEP TWO: Paste this code into the BODY of your HTML document –>
<!– This script and many more are available free online at –>
<!– The JavaScript Source!! [url]http://javascript.internet.com
<!– Original: David Coleman (
<!– Web Site: [url]http://www.hostcompanies.com/
<script language=”javascript”>
// Initialize array
var arr = new Array();
arr[arr.length] = new Array(“Search The Web”);
arr[arr.length] = new Array(“Popular=================”);
arr[arr.length] = new Array(“Aol”, “
arr[arr.length] = new Array(“IWon”, “
arr[arr.length] = new Array(“Cancer cure”, “
arr[arr.length] = new Array(“Animals Asia”, “
arr[arr.length] = new Array(“Give Food”, “
// etc…
// Add options to list
function addOptions()
{
var sel = document.searchForm.whichEngine;
for(var i = 0; i < arr.length; i++)
{
sel.options[i] = new Option(arr[i][0], i);
}
}
// Get url for search engine
function startSearch()
{
searchString = document.searchForm.searchText.value;
if(searchString != “”)
{
var searchEngine = document.searchForm.whichEngine.selectedIndex;
var finalSearchString = arr[searchEngine][1] + searchString;
location.href = finalSearchString;
}
return false;
}
// Check if key pressed == enter
function checkKey()
{
if(window.event.keyCode == ’13’)
{
return startSearch();
}
else return true;
}
</script>
<SCRIPT language=JavaScript type=text/javascript>
<!–
<!– Begin
function formHandler(form){
var URL = document.form.site.options[document.form.site.selectedIndex].value;
window.location.href = URL;
}
function expandDiv(tlll) {
what = eval(tlll + “_menu”);
if (what.style.display == “none”) {
what.style.display = “”;
}
else
what.style.display = “none”;
}
var oldc = new Array;
function cCell(r,m){
if(!document.all) return;
if(m){
for(i=0;i<r.cells.length;i++){
oldc[i]=r.cells[i].bgColor;
r.cells[i].bgColor=’D3D3D3′;
}
}else{
for(i=0;i<r.cells.length;i++){
r.cells[i].bgColor=oldc[i];
}
}
}
//
// Jump to a page
//
function jump() {
parent.location = document.links.url.options[document.links.url.selectedIndex].value;
}
//
// End –>
function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf(“#”)!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_findObj(n, d) { //v4.0
var p,i,x; if(!d) d=document; if((p=n.indexOf(“?”))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && document.getElementById) x=document.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//–>
</SCRIPT>
<form name=”searchForm”>
<div align=”center”><b>Search the web ></b>
<input name=”searchText” type=”text” onkeypress=”return checkKey()”/>
<select name=”whichEngine” style=”background-color: #F5F5F5; font-weight: bold”>
</select>
<input type=”button” value=”Search” onClick=”return startSearch()”/>
<br>
</font></b></font></font></font> </div>
</form>
<p><center>
<font face=”arial, helvetica” size”-2″>Free JavaScripts provided<br>
by <a href=”http://javascriptsource.com”>The JavaScript Source</a></font>
</center><p>
<!– Script Size: 14.22 KB –>