...

View Full Version : Java search result loading into IFRAME



Sain Cai
01-15-2003, 04:54 PM
I want to have a section in my website where people just have to type a name and it's html page loads (type "test" and "test.html" loads)

Now I can do this and it loads like a regular link, but I want the results to load into an IFRAME instead. The code is as follows:

function search(entry) {
if (entry!=""&&entry.length>3) {
out = " ";
temp = "" + entry;

while (temp.indexOf(out)>-1) {
pos= temp.indexOf(out);
temp = "" + (temp.substring(0, pos) +
temp.substring((pos + out.length), temp.length)); }

n = temp.toLowerCase();
filenm = n+".html";
if(n=="test")
{ location.replace(filenm); }
else
{ alert("Sorry, "+entry+"'s Profile Not Found");
document.fm.nm.value=""; }
}
else
{ document.fm.nm.value=""; }
}

hexColor = ["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"];

function mOver() {
for (i = 0; i < 13; i++) {
setTimeout('document.fm.button.style.background="#'+hexColor[12-i]+'0'+hexColor[12-i]+'0c0";', i * 40);
}
}

function mOut() {
document.fm.button.value="Search ";
for (i = 9; i > 0; i--) {
setTimeout('document.fm.button.style.background="#'+hexColor[i]+hexColor[i]+hexColor[i]+hexColor[i]+hexColor[i]+'0";', i * 40);
}
}

The page where I am experimenting is http://www.5-tigers.net/test/search/

Type "test" into the search box, and the "test.html" will load, but not into the IFRAME. Live Help can be given if wanted also AIM=Sain Cai

beetle
01-15-2003, 05:36 PM
Looks like it's working to me...did you fix this?

Sain Cai
01-15-2003, 06:06 PM
EDIT:

Got it to work now. changed the code to this in it's respective spot:

n = temp.toLowerCase();
filenm = n+".html";
if(n=="test"||n=="index")
{window.frames["cwindow"].location.replace(filenm); }

Thank everyone for their help (Search function)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum