惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

S
Secure Thoughts
云风的 BLOG
云风的 BLOG
Engineering at Meta
Engineering at Meta
A
About on SuperTechFans
Hugging Face - Blog
Hugging Face - Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
WordPress大学
WordPress大学
U
Unit 42
月光博客
月光博客
美团技术团队
S
Security Affairs
L
Lohrmann on Cybersecurity
Latest news
Latest news
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Application and Cybersecurity Blog
Application and Cybersecurity Blog
Recent Announcements
Recent Announcements
P
Palo Alto Networks Blog
The Last Watchdog
The Last Watchdog
T
Tor Project blog
Schneier on Security
Schneier on Security
Jina AI
Jina AI
MongoDB | Blog
MongoDB | Blog
Cloudbric
Cloudbric
B
Blog RSS Feed
Project Zero
Project Zero
Hacker News: Ask HN
Hacker News: Ask HN
Security Latest
Security Latest
C
Cybersecurity and Infrastructure Security Agency CISA
NISL@THU
NISL@THU
M
MIT News - Artificial intelligence
H
Help Net Security
Google DeepMind News
Google DeepMind News
L
LINUX DO - 热门话题
V
Visual Studio Blog
W
WeLiveSecurity
T
The Exploit Database - CXSecurity.com
Recent Commits to openclaw:main
Recent Commits to openclaw:main
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
T
Threat Research - Cisco Blogs
Help Net Security
Help Net Security
F
Fortinet All Blogs
IT之家
IT之家
A
Arctic Wolf
Apple Machine Learning Research
Apple Machine Learning Research
I
Intezer
D
DataBreaches.Net
C
Cyber Attacks, Cyber Crime and Cyber Security
Stack Overflow Blog
Stack Overflow Blog
SecWiki News
SecWiki News
Last Week in AI
Last Week in AI

博客园 - 戴玮

关于状态模式的思考 实在是忍受不了MSN的巨慢速度,重新换个地方 asp.net2.0 页面生命周期方法 C#加密与解决 如何自定义一个模板列,并在后台加载 ASP.NET常用的代码集合 - 戴玮 - 博客园 触发器示例代码 ADO.NET2.0分页 - 戴玮 - 博客园 如何查找 Office Web 组件 (OWC) 编程文档和示例 如何将枚举定义翻译成DataTable 网页中调用MSN添加好友工具 如何在XP SP2下面使用DTC Javascript 复制与粘贴 - 戴玮 - 博客园 如何在Component中取得Page对象 使用TransactionScope进行COM+事务处理 - 戴玮 - 博客园 如何在C#中使用EVAL方法 - 戴玮 - 博客园 巨NB的JAVASCRIPT代码 - 戴玮 - 博客园 9月25日C#->WebService中如何传递文件 解决了一年多的问题,狂喜(一年之前)
如果在网页中实现查找功能
戴玮 · 2006-11-15 · via 博客园 - 戴玮


有什么问题请到<a href='/bbs/forums.php?fid=21'>论坛</a>中发表<br>
<!--# 特效来源:http://www.webjx.com/js -->
<!-- 把如下代码加入<body>区域中 -->
 你可以输入'脚本'查查看<BR>有<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br> <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>
<div style="position:absolute;height:10pt;top:expression(document.body.clientHeight-this.style.pixelHeight+document.body.scrollTop-20);left:600px;font:9pt;">
<form style="background-color:#FFCC99" name="search" onSubmit="javascript:findInPage(this.string.value);return false;">
<font size=3><input name="string" type="text" size=15 onChange="n = 0;"></font>
<input type="submit" value="Find">
</form>
</div>