我找到一個站內蒐尋程式放在<body></body>之間 , 但是打入蒐尋字卻無法搜尋 ,
不知是程式那裡有錯 , 請有心人士幫我看看 .
<script language="JavaScript">
<!--
var NS4 = (document.layers);
var IE4 = (document.all);
var win = this;
var n = 0;
function findInPage(str) {
var txt, i, found;
if (str == "")
return false;
if (NS4) {
if (!win.find(str))
while(win.find(str, false, true))
n++;
else
n++;
if (n == 0) alert("本頁無任何【 " + str + " 】字句!");
}
if (IE4) {
txt = win.document.body.createTextRange();
for (i = 0; i <= n && (found = txt.findText(str)) != false; i++) {
txt.moveStart("character", 1);
txt.moveEnd("textedit");
}
if (found) {
txt.moveStart("character", -1);
txt.findText(str);
txt.select();
txt.scrollIntoView();
n++;
}
else {
if (n > 0) {
n = 0;
findInPage(str);
}
else
alert("本頁無任何【 " + str + " 】字句!");
}
}
return false;
}
-->
</script><form name=search>
<p align="left" style="line-height:100%; margin-top:0; margin-bottom:0;"><font color="#006600" size="2"><b>※請輸入欲尋找關鍵字</b></font>
<input name=string type=text size=15 value=軟體 onChange="n = 0;">
<input type=button value="搜尋" onClick="findInPage(this.form.string.value);">
</form>