<div class="htmlarea"> <textarea id="runcode25603"> <title>搜索页面内容</title> <script language="JavaScript"> var NS4 = (document.layers); var IE4 = (document.all); // window to search. var win = window; 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("对不起!没有你要找的内容。"); } 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("对不起!没有你要找的内容。"); } } return false; } </script> <form name="search" onsubmit="return findInPage(this.string.value);"> <input name="string" type="text" size="20" onchange="n = 0;"> <input type="submit" value="==>>搜"> </form> 1 2 3 4 5 6 7 8 9 10 11 12 13 </textarea><br><input onclick="runEx('runcode25603')" type="button" value="运行代码"> <input onclick="doCopy('runcode25603')" type="button" value="复制代码"> <input onclick="doSave(runcode25603)" type="button" value="保存代码">[Ctrl+A 全选 注:<a href="http://www.jb51.net/article/23421.htm" title="查看具体详情" target="_blank">如需引入外部Js需刷新才能执行</a>]</div>