页面内查找
时间:2023-07-02 05:25:46
你可以输入'脚本'查查看 查找页面中的字符 <script language="JavaScript"> var NS4 = (document.layers); // Which browser? var IE4 = (document.all); var win = window; // window to search. var n = 0; function findInPage(str) { var txt, i, found; if (str == "") return false; // Find next occurance of the given string on the page, wrap around to the // start of the page if necessary. if (NS4) { // Look for match starting at the current point. If not found, rewind // back to the first match. if (!win.find(str)) while(win.find(str, false, true)) n++; else n++; // If not found in either direction, give message. if (n == 0) alert("Not found."); } if (IE4) { txt = win.document.body.createTextRange(); // Find the nth match from the top of the page. for (i = 0; i <= n && (found = txt.findText(str)) != false; i++) { txt.moveStart("character", 1); txt.moveEnd("textedit"); } // If found, mark it and scroll it into view. if (found) { txt.moveStart("character", -1); txt.findText(str); txt.select(); txt.scrollIntoView(); n++; } // Otherwise, start over at the top of the page and find first match. else { if (n > 0) { n = 0; findInPage(str); } // Not found anywhere, give message. else alert("Not found."); } } return false; } </script> <form name="search" onSubmit="return findInPage(this.string.value);"> <font size=3><input name="string" type="text" size=15 onChange="n = 0;"></font> <input type="submit" value="Find"> </form>
标签:页面内查找
0
投稿
猜你喜欢
国外新闻报纸排版布局设计欣赏
2008-02-25 23:14:00
Golang 正则匹配效率详解
2024-01-30 03:41:47
Python super( )函数用法总结
2022-07-09 23:23:10
python关键字传递参数实例分析
2023-08-24 04:28:34
python数据库操作指南之PyMysql使用详解
2023-01-02 04:04:17
常用原生js自定义函数总结
2024-04-16 09:05:57
Python实现并行抓取整站40万条房价数据(可更换抓取城市)
2021-09-24 10:56:43
让ExtJs的combobox不显示HTML……
2009-05-31 17:01:00
解决Python字典查找报Keyerror的问题
2021-05-07 00:53:55
Vue Element前端应用开发之整合ABP框架的前端登录
2024-05-10 14:18:43
php防止sql注入之过滤分页参数实例
2023-07-21 10:02:40
mysql 备份与迁移 数据同步方法
2024-01-13 14:19:26
Python正则表达式教程之一:基础篇
2023-11-13 19:46:02
Python实现 版本号对比功能的实例代码
2022-07-22 05:53:59
python 找出list中最大或者最小几个数的索引方法
2022-08-12 13:23:11
垂直栅格与渐进式行距(上)
2009-04-01 18:30:00
Sphinx生成python文档示例图文解析
2022-06-07 23:35:50
利用Go语言实现Raft日志同步
2024-03-15 02:55:20
python3爬取torrent种子链接实例
2022-03-05 11:23:44
python已协程方式处理任务实现过程
2022-05-10 03:12:56