非常直观的搜索引擎系统,可以选择多个引擎
脚本说明:
第一步:把如下代码加入<body>区域中
<SCRIPT language=JavaScript>
function DynLayer(id,nestref,frame) {
if (!is.ns5 && !DynLayer.set && !frame) DynLayerInit()
this.frame = frame || self
if (is.ns) {
if (is.ns4) {
if (!frame) {
if (!nestref) var nestref = DynLayer.nestRefArray[id]
if (!DynLayerTest(id,nestref)) return
this.css = (nestref)? eval("document."+nestref+".document."+id) : document.layers[id]
}
else this.css = (nestref)? eval("frame.document."+nestref+".document."+id) : frame.document.layers[id]
this.elm = this.event = this.css
this.doc = this.css.document
}
else if (is.ns5) {
this.elm = document.getElementById(id)
this.css = this.elm.style
this.doc = document
}
this.x = this.css.left
this.y = this.css.top
this.w = this.css.clip.width
this.h = this.css.clip.height
}
else if (is.ie) {
this.elm = this.event = this.frame.document.all[id]
this.css = this.frame.document.all[id].style
this.doc = document
this.x = this.elm.offsetLeft
this.y = this.elm.offsetTop
this.w = (is.ie4)? this.css.pixelWidth : this.elm.offsetWidth
this.h = (is.ie4)? this.css.pixelHeight : this.elm.offsetHeight
}
this.id = id
this.nestref = nestref
this.obj = id + "DynLayer"
eval(this.obj + "=this")
}
function DynLayerMoveTo(x,y) {
if (x!=null) {
this.x = x
if (is.ns) this.css.left = this.x
else this.css.pixelLeft = this.x
}
if (y!=null) {
this.y = y
if (is.ns) this.css.top = this.y
else this.css.pixelTop = this.y
}
}
function DynLayerMoveBy(x,y) {
this.moveTo(this.x+x,this.y+y)
}
function DynLayerShow() {
this.css.visibility = (is.ns4)? "show" : "visible"
}
function DynLayerHide() {
this.css.visibility = (is.ns4)? "hide" : "hidden"
}
DynLayer.prototype.moveTo = DynLayerMoveTo
DynLayer.prototype.moveBy = DynLayerMoveBy
DynLayer.prototype.show = DynLayerShow
DynLayer.prototype.hide = DynLayerHide
DynLayerTest = new Function('return true')
// DynLayerInit Function
function DynLayerInit(nestref) {
if (!DynLayer.set) DynLayer.set = true
if (is.ns) {
if (nestref) ref = eval('document.'+nestref+'.document')
else {nestref = ''; ref = document;}
for (var i=0; i<ref.layers.length; i++) {
var divname = ref.layers[i].name
DynLayer.nestRefArray[divname] = nestref
var index = divname.indexOf("Div")
if (index > 0) {
eval(divname.substr(0,index)+' = new DynLayer("'+divname+'","'+nestref+'")')
}
if (ref.layers[i].document.layers.length > 0) {
DynLayer.refArray[DynLayer.refArray.length] = (nestref=='')? ref.layers[i].name : nestref+'.document.'+ref.layers[i].name
}
}
if (DynLayer.refArray.i < DynLayer.refArray.length) {
DynLayerInit(DynLayer.refArray[DynLayer.refArray.i++])
}
}
else if (is.ie) {
for (var i=0; i<document.all.tags("DIV").length; i++) {
var divname = document.all.tags("DIV")[i].id
var index = divname.indexOf("Div")
if (index > 0) {
eval(divname.substr(0,index)+' = new DynLayer("'+divname+'")')
}
}
}
return true
}
DynLayer.nestRefArray = new Array()
DynLayer.refArray = new Array()
DynLayer.refArray.i = 0
DynLayer.set = false
// Slide Methods
function DynLayerSlideTo(endx,endy,inc,speed,fn) {
if (endx==null) endx = this.x
if (endy==null) endy = this.y
var distx = endx-this.x
var disty = endy-this.y
this.slideStart(endx,endy,distx,disty,inc,speed,fn)
}
function DynLayerSlideBy(distx,disty,inc,speed,fn) {
var endx = this.x + distx
var endy = this.y + disty
this.slideStart(endx,endy,distx,disty,inc,speed,fn)
}
function DynLayerSlideStart(endx,endy,distx,disty,inc,speed,fn) {
if (this.slideActive) return
if (!inc) inc = 10
if (!speed) speed = 20
var num = Math.sqrt(Math.pow(distx,2) + Math.pow(disty,2))/inc
if (num==0) return
var dx = distx/num
var dy = disty/num
if (!fn) fn = null
this.slideActive = true
this.slide(dx,dy,endx,endy,num,1,speed,fn)
}
function DynLayerSlide(dx,dy,endx,endy,num,i,speed,fn) {
if (!this.slideActive) return
if (i++ < num) {
this.moveBy(dx,dy)
this.onSlide()
if (this.slideActive) setTimeout(this.obj+".slide("+dx+","+dy+","+endx+","+endy+","+num+","+i+","+speed+",\""+fn+"\")",speed)
else this.onSlideEnd()
}
else {
this.slideActive = false
this.moveTo(endx,endy)
this.onSlide()
this.onSlideEnd()
eval(fn)
}
}
function DynLayerSlideInit() {}
DynLayer.prototype.slideInit = DynLayerSlideInit
DynLayer.prototype.slideTo = DynLayerSlideTo
DynLayer.prototype.slideBy = DynLayerSlideBy
DynLayer.prototype.slideStart = DynLayerSlideStart
DynLayer.prototype.slide = DynLayerSlide
DynLayer.prototype.onSlide = new Function()
DynLayer.prototype.onSlideEnd = new Function()
// Clip Methods
function DynLayerClipInit(clipTop,clipRight,clipBottom,clipLeft) {
if (is.ie) {
if (arguments.length==4) this.clipTo(clipTop,clipRight,clipBottom,clipLeft)
else if (is.ie4) this.clipTo(0,this.css.pixelWidth,this.css.pixelHeight,0)
}
}
function DynLayerClipTo(t,r,b,l) {
if (t==null) t = this.clipValues('t')
if (r==null) r = this.clipValues('r')
if (b==null) b = this.clipValues('b')
if (l==null) l = this.clipValues('l')
if (is.ns) {
this.css.clip.top = t
this.css.clip.right = r
this.css.clip.bottom = b
this.css.clip.left = l
}
else if (is.ie) this.css.clip = "rect("+t+"px "+r+"px "+b+"px "+l+"px)"
}
function DynLayerClipBy(t,r,b,l) {
this.clipTo(this.clipValues('t')+t,this.clipValues('r')+r,this.clipValues('b')+b,this.clipValues('l')+l)
}
function DynLayerClipValues(which) {
if (is.ie) var clipv = this.css.clip.split("rect(")[1].split(")")[0].split("px")
if (which=="t") return (is.ns)? this.css.clip.top : Number(clipv[0])
if (which=="r") return (is.ns)? this.css.clip.right : Number(clipv[1])
if (which=="b") return (is.ns)? this.css.clip.bottom : Number(clipv[2])
if (which=="l") return (is.ns)? this.css.clip.left : Number(clipv[3])
}
DynLayer.prototype.clipInit = DynLayerClipInit
DynLayer.prototype.clipTo = DynLayerClipTo
DynLayer.prototype.clipBy = DynLayerClipBy
DynLayer.prototype.clipValues = DynLayerClipValues
// Write Method
function DynLayerWrite(html) {
if (is.ns) {
this.doc.open()
this.doc.write(html)
this.doc.close()
}
else if (is.ie) {
this.event.innerHTML = html
}
}
DynLayer.prototype.write = DynLayerWrite
// BrowserCheck Object
function BrowserCheck() {
var b = navigator.appName
if (b=="Netscape") this.b = "ns"
else if (b=="Microsoft Internet Explorer") this.b = "ie"
else this.b = b
this.version = navigator.appVersion
this.v = parseInt(this.version)
this.ns = (this.b=="ns" && this.v>=4)
this.ns4 = (this.b=="ns" && this.v==4)
this.ns5 = (this.b=="ns" && this.v==5)
this.ie = (this.b=="ie" && this.v>=4)
this.ie4 = (this.version.indexOf('MSIE 4')>0)
this.ie5 = (this.version.indexOf('MSIE 5')>0)
this.min = (this.ns||this.ie)
}
is = new BrowserCheck()
// CSS Function
function css(id,left,top,width,height,color,vis,z,other) {
if (id=="START") return '<STYLE TYPE="text/css">\n'
else if (id=="END") return '</STYLE>'
var str = (left!=null && top!=null)? '#'+id+' {position:absolute; left:'+left+'px; top:'+top+'px;' : '#'+id+' {position:relative;'
if (arguments.length>=4 && width!=null) str += ' width:'+width+'px;'
if (arguments.length>=5 && height!=null) {
str += ' height:'+height+'px;'
if (arguments.length<9 || other.indexOf('clip')==-1) str += ' clip:rect(0px '+width+'px '+height+'px 0px);'
}
if (arguments.length>=6 && color!=null) str += (is.ns)? ' layer-background-color:'+color+';' : ' background-color:'+color+';'
if (arguments.length>=7 && vis!=null) str += ' visibility:'+vis+';'
if (arguments.length>=8 && z!=null) str += ' z-index:'+z+';'
if (arguments.length==9 && other!=null) str += ' '+other
str += '}\n'
return str
}
function writeCSS(str,showAlert) {
str = css('START')+str+css('END')
document.write(str)
if (showAlert) alert(str)
}
</SCRIPT>
<SCRIPT language=JavaScript>
function MiniScroll(window,content) {
this.window = window
this.content = content
this.inc = 8
this.speed = 20
this.contentHeight = (is.ns)? this.content.doc.height : this.content.elm.scrollHeight
this.contentWidth = (is.ns)? this.content.doc.width : this.content.elm.scrollWidth
this.up = MiniScrollUp
this.down = MiniScrollDown
this.left = MiniScrollLeft
this.right = MiniScrollRight
this.stop = MiniScrollStop
this.activate = MiniScrollActivate
this.activate(this.contentWidth,this.contentHeight)
}
function MiniScrollActivate() {
this.offsetHeight = this.contentHeight-this.window.h
this.offsetWidth = this.contentWidth-this.window.w
this.enableVScroll = (this.offsetHeight>0)
this.enableHScroll = (this.offsetWidth>0)
}
function MiniScrollUp() {
if (this.enableVScroll) this.content.slideTo(null,0,this.inc,this.speed)
}
function MiniScrollDown() {
if (this.enableVScroll) this.content.slideTo(null,-this.offsetHeight,this.inc,this.speed)
}
function MiniScrollLeft() {
if (this.enableHScroll) this.content.slideTo(0,null,this.inc,this.speed)
}
function MiniScrollRight() {
if (this.enableHScroll) this.content.slideTo(-this.offsetWidth,null,this.inc,this.speed)
}
function MiniScrollStop() {
this.content.slideActive = false
}
</SCRIPT>
<SCRIPT language=JavaScript>
<!--
// list of engines and the query string for each of the forms
engine = 0
engineList = new Array("yahoo","altavista","hotbot","dejanews","excite","lycos","webcrawler","infoseek","freshmeat","mediafind")
engineListQuery = new Array("p","q","MT","QRY","search","query","text","qt","query","file")
// rollover stuff
function preload(imgObj,imgSrc) {
eval(imgObj+' = new Image()')
eval(imgObj+'.src = "'+imgSrc+'"')
}
function tabroll(i,state) {
engineTabC.changeImage(engineList[i]+'tab',engineList[i]+'t'+state)
}
for (var i=0;i<engineList.length;i++) {
eval('preload("'+engineList[i]+'t0","t-'+engineList[i]+'0.gif")')
eval('preload("'+engineList[i]+'t1","t-'+engineList[i]+'1.gif")')
}
function init() {
DynLayerInit()
engineTabC.changeImage = DynLayerChangeImage
tabscroll = new MiniScroll(engineTabW,engineTabC)
buttonList = new Array()
for (i in engineList) {
buttonList[i] = new DynLayer(engineList[i]+'Button')
buttonList[i].slideInit()
}
sfocus()
}
function sfocus() {
formLayer.doc.searchForm.searchText.focus()
}
function searchSubmit() {
var query = formLayer.doc.searchForm.searchText.value
if (query=="") {
sfocus()
return false
}
f = eval("document."+engineList[engine]+"form")
eval("f."+engineListQuery[engine]+".value = '"+query+"'")
f.submit()
return false
}
function replaceEngine(i) {
if (i != engine) {
old = engine
buttonList[old].slideTo(null,32,5,20)
buttonList[old].onSlideEnd = new Function("buttonList[old].moveTo(null,-32)")
buttonList[i].slideTo(null,2,5,20)
engine = i
}
sfocus()
}
function DynLayerChangeImage(imgName,imgObj) {
this.doc.images[imgName].src = eval(imgObj+'.src')
}
//-->
</SCRIPT>
<SCRIPT language=JavaScript>
<!--
winW = (is.ns)? window.innerWidth-16 : document.body.offsetWidth-20
winH = (is.ns)? window.innerHeight : document.body.offsetHeight
var str = css("START")+
css("search",(winW-300)/2,10,null,null)+
css("engineBG",0,0,300,34,'white')+
css("formLayerDiv",102,-1)+
css("tab",0,36,300,15)+
css("tabL",0,0)+
css("engineTabWDiv",15,0,270,15)+
css("engineTabCDiv",0,0)+
css("tabR",285,0)+
css("searchButton",0,0,100,34,'white')+
css("yahooButton",0,2)+
css("altavistaButton",0,-32)+
css("hotbotButton",0,-32)+
css("dejanewsButton",0,-32)+
css("exciteButton",0,-32)+
css("lycosButton",0,-32)+
css("webcrawlerButton",0,-32)+
css("infoseekButton",0,-32)+
css("freshmeatButton",0,-32)+
css("mediafindButton",0,-32)+
css("hotmail",0,200)+
css('END')
document.write(str)
//-->
</SCRIPT>
<DIV id=search>
<DIV id=engineBG></DIV>
<DIV id=searchButton>
<DIV id=yahooButton><A href="http://www.yahoo.com/"><IMG height=30 alt=Yahoo!
src="yahoo.gif" width=100 border=0 name=yahooImg></A></DIV>
<DIV id=altavistaButton><A href="http://www.altavista.com/"><IMG height=30
alt="Alta Vista" src="altavista.gif" width=100 border=0
name=altavistaImg></A></DIV>
<DIV id=hotbotButton><A href="http://www.hotbot.com/"><IMG height=30 alt=HotBot
src="hotbot.gif" width=100 border=0 name=hotbotImg></A></DIV>
<DIV id=dejanewsButton><A href="http://www.dejanews.com/"><IMG height=30
alt=DejaNews src="dejanews.gif" width=100 border=0
name=dejanewsImg></A></DIV>
<DIV id=exciteButton><A href="http://www.excite.com/"><IMG height=30 alt=Excite
src="excite.gif" width=100 border=0 name=exciteImg></A></DIV>
<DIV id=lycosButton><A href="http://www.lycos.com/"><IMG height=30 alt=Lycos
src="lycos.gif" width=100 border=0 name=lycosImg></A></DIV>
<DIV id=webcrawlerButton><A href="http://www.webcrawler.com/"><IMG height=30
alt=Webcrawler src="webcrawler.gif" width=100 border=0
name=webcrawlerImg></A></DIV>
<DIV id=infoseekButton><A href="http://www.infoseek.com/"><IMG height=30
alt=Infoseek src="infoseek.gif" width=100 border=0
name=infoseekImg></A></DIV>
<DIV id=freshmeatButton><A href="http://www.freshmeat.net/"><IMG height=30
alt=Freshmeat src="freshmeat.gif" width=100 border=0
name=freahmeatImg></A></DIV>
<DIV id=mediafindButton><A href="http://194.95.209.6/"><IMG height=30
alt=Mediafind src="mediafind.gif" width=100 border=0
name=mediafindImg></A></DIV></DIV>
<DIV id=formLayerDiv>
<TABLE cellSpacing=0 cellPadding=0 width=200 border=0>
<TBODY>
<TR>
<TD align=middle>
<FORM name=searchForm onsubmit="searchSubmit(); return false"><INPUT
name=searchText> </FORM></TD></TR></TBODY></TABLE></DIV>
<DIV id=tab>
<DIV id=tabL><A onmouseup=tabscroll.stop()
onmousedown="tabscroll.left(); return false;" onmouseout=tabscroll.stop()
href="javascript://"><IMG height=15 src="arrowL.gif" width=15
border=0></A></DIV>
<DIV id=engineTabWDiv>
<DIV id=engineTabCDiv>
<TABLE cellSpacing=0 cellPadding=0 border=0>
<TBODY>
<TR>
<TD><A onmouseover=tabroll(0,1) onmouseout=tabroll(0,0)
href="javascript:replaceEngine(0)"><IMG height=15
src="t-yahoo0.gif" width=38 border=0 name=yahootab></A></TD>
<TD><A onmouseover=tabroll(1,1) onmouseout=tabroll(1,0)
href="javascript:replaceEngine(1)"><IMG height=15
src="t-altavista0.gif" width=49 border=0 name=altavistatab></A></TD>
<TD><A onmouseover=tabroll(2,1) onmouseout=tabroll(2,0)
href="javascript:replaceEngine(2)"><IMG height=15
src="t-hotbot0.gif" width=39 border=0 name=hotbottab></A></TD>
<TD><A onmouseover=tabroll(3,1) onmouseout=tabroll(3,0)
href="javascript:replaceEngine(3)"><IMG height=15
src="t-dejanews0.gif" width=55 border=0 name=dejanewstab></A></TD>
<TD><A onmouseover=tabroll(4,1) onmouseout=tabroll(4,0)
href="javascript:replaceEngine(4)"><IMG height=15
src="t-excite0.gif" width=35 border=0 name=excitetab></A></TD>
<TD><A onmouseover=tabroll(5,1) onmouseout=tabroll(5,0)
href="javascript:replaceEngine(5)"><IMG height=15
src="t-lycos0.gif" width=34 border=0 name=lycostab></A></TD>
<TD><A onmouseover=tabroll(6,1) onmouseout=tabroll(6,0)
href="javascript:replaceEngine(6)"><IMG height=15
src="t-webcrawler0.gif" width=64 border=0
name=webcrawlertab></A></TD>
<TD><A onmouseover=tabroll(7,1) onmouseout=tabroll(7,0)
href="javascript:replaceEngine(7)"><IMG height=15
src="t-infoseek0.gif" width=48 border=0 name=infoseektab></A></TD>
<TD><A onmouseover=tabroll(8,1) onmouseout=tabroll(8,0)
href="javascript:replaceEngine(8)"><IMG height=15
src="t-freshmeat0.gif" width=59 border=0 name=freshmeattab></A></TD>
<TD><A onmouseover=tabroll(9,1) onmouseout=tabroll(9,0)
href="javascript:replaceEngine(9)"><IMG height=15
src="t-mediafind0.gif" width=57 border=0
name=mediafindtab></A></TD></TR></TBODY></TABLE></DIV></DIV>
<DIV id=tabR><A onmouseup=tabscroll.stop()
onmousedown="tabscroll.right(); return false;" onmouseout=tabscroll.stop()
href="javascript://"><IMG height=15 src="arrowR.gif" width=15
border=0></A></DIV></DIV></DIV>
<FORM name=yahooform action=http://search.yahoo.com/bin/search method=get><INPUT
type=hidden name=p> </FORM>
<FORM name=altavistaform action=http://www.altavista.com/cgi-bin/query
method=get><INPUT type=hidden name=q> <INPUT type=hidden value=XX name=kl>
</FORM>
<FORM name=hotbotform action=http://www.hotbot.com/ method=get><INPUT
type=hidden name=MT> <INPUT type=hidden value=MC name=SM> <INPUT type=hidden
value=0 name=DV> <INPUT type=hidden value=any name=LG> <INPUT type=hidden
value=25 name=DC> <INPUT type=hidden value=1 name=DE> </FORM>
<FORM name=dejanewsform action=http://www.dejanews.com/dnquery.xp
method=get><INPUT type=hidden name=QRY> <INPUT type=hidden value=2 name=DBS>
<INPUT type=hidden value=40 name=maxhits> <INPUT type=hidden value=terse
name=format> <INPUT type=hidden value=score name=showsort> <INPUT type=hidden
value=QS name=ST> <INPUT type=hidden value=ALL name=LNG> </FORM>
<FORM name=exciteform action=http://www.excite.com/search.gw method=get><INPUT
type=hidden name=search> <INPUT type=hidden value=web name=collection> </FORM>
<FORM name=lycosform action=http://www.lycos.com/cgi-bin/pursuit
method=get><INPUT type=hidden name=query> <INPUT type=hidden value=lycos
name=cat> <INPUT type=hidden value=and name=matchmode> <INPUT type=hidden
value=.9 name=minscore> <INPUT type=hidden value=20 name=maxhits> <INPUT
type=hidden value=terse name=terse> </FORM>
<FORM name=webcrawlerform action=http://www.webcrawler.com/cgi-bin/WebQuery
method=post><INPUT type=hidden name=text> </FORM>
<FORM name=infoseekform action=http://www.infoseek.com/Titles method=get><INPUT
type=hidden name=qt> <INPUT type=hidden value=IS name=sv> <INPUT type=hidden
value=ip-noframes name=lk> <INPUT type=hidden value=10 name=nh> </FORM>
<FORM name=freshmeatform action=http://core.freshmeat.net/search.php3
method=post><INPUT type=hidden name=query> </FORM>
<FORM name=mediafindform action=http://194.95.209.6/cgi-bin/search.cgi
method=get><INPUT type=hidden name=file> <INPUT type=hidden value=mp3
name=filetype> </FORM>
第二步:把<body>中的内容改为:
<body bgcolor="#fef4d9" onload=init()>
