<style type=text/css>
BODY {
    FONT-FAMILY: "宋体","Arial","Times New Roman"; FONT-SIZE: 12px; LETTER-SPACING: 1pt; LINE-HEIGHT: 22px; MARGIN-LEFT: 5pt; MARGIN-TOP: 5pt
}
#scontentmain {
    BACKGROUND-IMAGE: url(http://www.jzzy.com/photo/pc0415.gif); HEIGHT: 30px; POSITION: absolute; TOP: 28px; WIDTH: 228px
}
#scontentbar {
    BORDER-BOTTOM: black 1px solid; BORDER-LEFT: black 1px solid; BORDER-RIGHT: black 1px solid; BORDER-TOP: black 1px solid; CURSOR: hand; HEIGHT: 15px; PADDING-BOTTOM: 1px; PADDING-LEFT: 1px; PADDING-RIGHT: 1px; PADDING-TOP: 1px; POSITION: absolute; TOP: 5px; WIDTH: 100%
}
#scontentsub {
    POSITION: absolute; TOP: 28px; WIDTH: 100%
}
A.a1:hover {
    BORDER-BOTTOM: #4a8ff2 1px solid; BORDER-LEFT: #4a8ff2 1px solid; BORDER-RIGHT: #4a8ff2 1px solid; BORDER-TOP: #4a8ff2 1px solid; LINE-HEIGHT: 13pt; WIDTH: 83px; 12px;: 1869FE; align: center
}
A.a1:link {
    COLOR: #ffffff; TEXT-DECORATION: none; 12px;align: center
}
TD {
    FONT-SIZE: 12px
}
.pos {
    POSITION: relative
}
</style>
<SCRIPT language=JavaScript>
/*** DownLoad.PcHome.net Online Search Engine ***/
/*** Author:Yoo Lee ***/
/*** Version:1.0 2001/06/04 ***/
var dragapproved=false
var zcor,xcor,ycor
function drag_onclick() {
    if  (search1.drag.checked == true ) dragapproved=false
    else dragapproved=true
    }
function movescontentmain(){
if (event.button==1&&dragapproved&&search1.drag.checked == true){
zcor.style.pixelLeft=tempvar1+event.clientX-xcor
zcor.style.pixelTop=tempvar2+event.clientY-ycor
leftpos=document.all.scontentmain.style.pixelLeft-document.body.scrollLeft
toppos=document.all.scontentmain.style.pixelTop-document.body.scrollTop
return false
}
}
function dragscontentmain(){
if (!document.all)
return
if (event.srcElement.id=="scontentbar"){
dragapproved=true
zcor=scontentmain
tempvar1=zcor.style.pixelLeft
tempvar2=zcor.style.pixelTop
xcor=event.clientX
ycor=event.clientY
document.onmousemove=movescontentmain
}
}
document.onmousedown=dragscontentmain
document.onmouseup=new Function("dragapproved=false")
function aa(e)
{
if (e==0) alert("\n-  =  页面字符搜索引擎 1.0 测试版    =      \n\n-               电脑之家 版权所有\n\n-         重写了部分代码\n-         修正鼠标拖动跳跃的bug,\n-         保留选择可否拖动……\n\n-             其他功能正在测试中!\n\n");
return;    
}
function  cose()
{
if(confirm("即将关闭此窗口,如确认请按确定!\n\n如要重开此窗口请刷新页面。"))
scontentmain.style.display='none'
else 
scontentmain.style.display=''
}
//screen.width,screen.height
document.write('<div id="scontentmain"><form name="search1" onSubmit="return findInPage(this.Word.value);"><div id="scontentbar">                      <img src="http://www.jzzy.com/photo/alt0415.gif" alt="帮助" border="0" onClick="aa(0)"><img src="http://www.jzzy.com/photo/usr0415.gif" usemap="#Map" border="0"><map name="Map"><area shape="rect" coords="20,0,40,20" alt="最大化" onclick="offdisplay()"><area shape="rect" coords="0,0,20,20" alt="最小化" onclick="ondisplay()"><area shape="rect" shape="rect"  coords="34,0,60,19" alt="关闭" onclick="cose()"></map></div><div id="scontentsub"" style="visibility: show"><table width="228" border="1" cellpadding="2" cellspacing="0" bordercolorlight="#000000" bordercolordark="#FFFFFF" bgcolor="#0099CC" class=font1><tr bgcolor="#2D96FF"><td height="2" colspan="2" align="center"><input type="text"  name="Word" size="30" onChange="n = 0;" onFocus=window.document.search1.Word.value=""  style="background-image: url(http://www.jzzy.com/./photo/address0415.gif)" ></td></tr><tr bgcolor="#CCCCCC"><td width="222">   <input type="checkbox" name="drag" value="搜索" LANGUAGE=javascript onclick="return drag_onclick()">可用鼠标拖动窗口 <a href="#top"><img src="http://www.jzzy.com/photo/top0415.gif" alt="GO TOP" border="0" valign="center"></a></td><td width="61" align="center"><input type="submit" name="Submit" value="搜索"></td></tr></form></table></div></DIV>');/******************** do Floating Window's Mouse Action ********************/var w=document.body.clientWidth-450
var h=190
w+=document.body.scrollLeft
h+=document.body.scrollTopvar leftpos=w
var toppos=h
scontentmain.style.left=w
scontentmain.style.top=hfunction ondisplay(){
if (scontentsub.style.display=='')
scontentsub.style.display='none'
else
scontentsub.style.display==''
}function offdisplay(){
if (scontentsub.style.display=='none')
scontentsub.style.display=''
else
scontentsub.style.display=='none'
}function staticize(){
w2=document.body.scrollLeft+leftpos
h2=document.body.scrollTop+toppos
scontentmain.style.left=w2
scontentmain.style.top=h2
}
window.onscroll=staticizefunction GetWord() 
{
    var tr
//    event.cancelBubble = true 
//    event.returnValue=false
}
function FindWord(w)
{
    for (var i=0;i<WordList.options.length;i++)
        if (WordList.options[i].text==w) 
        {
            WordList.options[i].selected=true
            Output.value=WordExpln[i]
            RESULT.style.visibility="visible"
            return true
        }
    return false
}
/******************** Main Part ********************/
var canDrag=0,canGetWord=0
var oldtop=0,oldscrolltop=0
var WordExpln=new Array()
var G_xmlHTTP
document.onmousemove = GetWordvar 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 + " ...             您要找的文字不存在。\n \n请试着输入页面中的关键字再次查找!\n \n 并且请注意,不要把“?”或“:”也输入查找!!!");
    }    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 + "...            您要找的文字不存在。\n \n请试着输入页面中的关键字再次查找!\n \n 并且请注意,不要把“?”或“:”也输入查找!!!");
        }
    }
    return false;
}self.onError=null;
    currentX = currentY = 0;  
    whichIt = null;   
    lastScrollX = 0; lastScrollY = 0;
    NS = (document.layers) ? 1 : 0;
    IE = (document.all) ? 1: 0;
</SCRIPT>

解决方案 »

  1.   

    谢谢楼上兄弟,这个很不错,我以前在PConline上看到过这个效果,但主要是记不起来了,它好象是调用的WS来做的,就几句话,不知道兄弟能否再赐教
      

  2.   

    可能需要调整浏览器安全级别
    <script language="JScript">
    function find(){
    var WshShell =new ActiveXObject("WScript.Shell");
    WshShell.SendKeys ("^f");
    }
    </script>
    <a href="javascript:find()">find</a>
      

  3.   

    awaysrain(绝对零度)(新的一年,新的开始) 的OK
      

  4.   

    awaysrain(绝对零度)(新的一年,新的开始) 在本地是没问题的但是在站点里面或者放到Internet上肯定不行
    IE安全不允许
      

  5.   

    还有一个方法是:
    document.execCommand('Find')
    但现在最新的DHTML在execCommand中好像不支持Find属性,不知道这个要怎么用??
      

  6.   

    对啊,但我的意思就是调出IE的查找对话框,就是按Ctrl+F的那个,兄弟们给个答案吧