Hopfull what follows will make sense to you.
I have this wonderful site with iframe which is set up with a javascript language switcher.
I needed a php-free search engine for the site and I found a JavaScript one on the net which seems to work fine. The only thing is, it opens search results in a new window rather than in the iframe. This is actually no big deal. T
The issue is that when I click the search result I am interested in, I would like javascript to open the page where the info is nested WITHIN my iframe INSTEAD OF WITHIN THE SEARCH WINDOW.
I understand it is probably a minor tweak only. I need to target the iframe for the content to open in there but HOW?
Here's the relevant code :
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com
<head>
....
<script type="text/javascript">
<!-- Here's the Language Switcher Code -->
var frameLink = "home/home.html"
function changeFrame(link)
{
document.getElementById("language").src = link.href;
frameLink = link.href;
return false;
}
function setFrame( )
{
if ( location.search.length > 1 )
{
var frameurl = unescape(location.search.substring(1));
// this version is for the English index page:
frameurl = frameurl.replace( /francais\/home/i, "english\/home" );
frameurl = frameurl.replace( /francais\/join/i, "english/join" );
frameurl = frameurl.replace( /francais\/judicial/i, "english/judicial" );
frameurl = frameurl.replace( /francais\/legislative/ig, "english/legislative" );
frameurl = frameurl.replace( /francais\/links/ig, "english/links" );
frameurl = frameurl.replace( /francais\/publications/ig, "english/publications" );
frameurl = frameurl.replace( /francais\/revision/ig, "english/revision" );
frameurl = frameurl.replace( /francais\/translation/ig, "english/translation" );
document.getElementById("language").src = frameurl;
frameLink = frameurl;
}
}
</script>
<!-- Here's the Search Engline Code -->
<SCRIPT LANGUAGE="JavaScript">
var item = new Array();
c=0; item[c]=new Array("index-e.htm","","Dear Colleagues","Lorem,ipsum dolor", "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et...");
c++; item[c]=new Array("about.htm","","About Me","about,author,contact,email,who","Contact details and general information about the creator of the site and what the site is about.");
c++; item[c]=new Array("links.htm","","Links page","links,more,where,similar,friends","Links to my favourite sites which I find interesting. Other friends sites which have similar interests to my own.");
c++; item[c]=new Array("main.htm","main/","Main Page","content,main,focus","The main part of my site which contains what you have come to see. Lots of stuff like that and more great things. All in a sub directory.");
c++; item[c]=new Array("logo.jpg","main/images/","Link Logo","link,image,logo,graphic","The logo.jpg is just a small image which you can place on your site as a link to me. It's in a second level subdirectory.");
page="<html><head><title>Search Results</title></head><body bgcolor='white'><center><table border=0 cellspacing=10 width=80%>";
function search(frm) {
win = window.open("","","scrollbars");
win.document.write(page);
txt = frm.srchval.value.split(" ");
fnd = new Array(); total=0;
for (i = 0; i < item.length; i++) {
fnd = 0; order = new Array(0, 4, 2, 3);
for (j = 0; j < order.length; j++)
for (k = 0; k < txt.length; k++)
if (item[order[j]].toLowerCase().indexOf(txt[k]) > -1 && txt[k] != "")
fnd += (j+1);
}
for (i = 0; i < fnd.length; i++) {
n = 0; w = -1;
for (j = 0;j < fnd.length; j++)
if (fnd[j] > n) { n = fnd[j]; w = j; };
if (w > -1) total += show(w, win, n);
fnd[w] = 0;
}
win.document.write("</table><br>Total found: "+total+"<br></body></html>");
win.document.close();
}
function show(which,wind,num) {
link = item[which][1] + item[which][0];
line = "<tr><td><a href='"+link+"'>"+item[which][2]+"</a> Score: "+num+"<br>";
line += item[which][4] + "<br>"+link+"</td></tr>";
wind.document.write(line);
return 1;
}
// End -->
</script>
</head>
<body onload="setFrame();">
.....
<!-- Here's the iframe I want the page to open in -->
<iframe id="language" style="width: 788px; height: 650px" frameborder="0" src="home/home.html">
Your browser does not support inline frames or is currently configured not to display inline frames.
</iframe>
....
</body>
</html>