廣告廣告
  加入我的最愛 設為首頁 風格修改
首頁 首尾
 手機版   訂閱   地圖  簡體 
您是第 2411 個閱讀者
 
發表文章 發表投票 回覆文章
  可列印版   加為IE收藏   收藏主題   上一主題 | 下一主題   
ericleesky 手機
個人頭像
個人文章 個人相簿 個人日記 個人地圖
初露鋒芒
級別: 初露鋒芒 該用戶目前不上站
推文 x0 鮮花 x96
分享: 轉寄此文章 Facebook Plurk Twitter 複製連結到剪貼簿 轉換為繁體 轉換為簡體 載入圖片
推文 x0
[JScript][討論] 網頁文字搜尋引擎
‧步驟一:將以下原始碼加入<HEAD>與</HEAD>標籤之間.

<!--
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>
<font color="#CC0000">請輸入你想尋找的關鍵字,僅限本網頁</font><BR>
<input name=string type=text size=15 onfiltered="n = 0;">
<input type=button value="搜尋" onfiltered="findInPage(this.form.string.value);"></form>



   
獻花 x0 回到頂端 [樓 主] From:局域網 | Posted:2005-03-15 18:12 |

首頁  發表文章 發表投票 回覆文章
Powered by PHPWind v1.3.6
Copyright © 2003-04 PHPWind
Processed in 0.010434 second(s),query:15 Gzip disabled
本站由 瀛睿律師事務所 擔任常年法律顧問 | 免責聲明 | 本網站已依台灣網站內容分級規定處理 | 連絡我們 | 訪客留言