<div class="codetitle"> <span><a style="CURSOR: pointer" data="36280" class="copybut" id="copybut36280" onclick="doCopy('code36280')"><u>複製程式碼</u></a></span> 程式碼如下:</div> <div class="codebody" id="code36280"> <br> <br><br><br>自動完成<br>< ;meta http-equiv ="Content-Type" content="text/html; charset=utf-8" /><br><style type="text/css"><BR>.autoComplete {margin: 8px;position:relative;float: left;}<BR>.autoComplete 輸入{width:200px;height:25px;margin:0;padding:0;line-height:25px;}<BR>.autoComplete ul {z-索引:-12;填充:0px ;邊距:0px;邊框:1px #333 實心;寬度:200px;背景:白色;顯示:無;位置:絕對;左:0;頂部:28px;*左邊距:9px ;*margin-top:2px; margin-top:1px;}<BR>.autoComplete li {list-style:none;}<BR>.autoComplete li a {display:block;color:#000;text-decoration: none;padding:1px 0 1px 5px ;_width:97%;}<BR>.autoComplete li a:hover {color:#000;background:#ccc;border:none;}<BR></style> <br><script type="text/javascript "><BR>//<![CDATA[<BR>var getElementsByClassName = function (searchClass, node, tag) {/* 相容各瀏覽器的選擇類別的方法;(:http://www.jb51.net ,想了解更多請看這個地址) */<BR> 節點= 節點||文檔,標籤=標籤? tag.toUpperCase() : "*";<BR> if(document.getElementsByClassName){/* 支援getElementsByClassName 的瀏覽器*/<BR> (tag== "*"){<BR> return temp;<BR> } else {<BR> for(var i=0; i<temp.length; i )<BR> 若(temp[i].nodeName==tag)<BR> ret.push(temp[i]);<BR> }else{/* 不支援getElementsByClassName的瀏覽器*/ <BR> var classes = searchClass.split(" "),<BR> elements = (tag === "*" & node. 模式= [ ], returnElements = [], current, match;<BR> var i = classes.length;<BR> while(--i >= 0 )< |s)" classes[i] "(s|$)"));<BR> var j = elements.length;<BR> while(--j se ;<BR> for(var k=0, kl=patterns.length; k<kl; k ){<BR> if(!match) break ;<BR> }<BR> if(match) returnElement ;<BR> }<BR>};<BR>var addEvent=(function(){/ * 使用此函數新增事件阻止事件覆寫*/<BR> if(document.addEventListener){<BR> return function(type, fn) { this.addEventListener (type, fn, false); if(document.attachEvent){<BR> return function(type,fn){<BR> return fn.call(this, window.event);/* 相容IE */<BR> });<BR> };<BR> }<BR>}<BR>}<BR>}<)();<BR>;(function(window){<BR>/* 外掛程式開始*/<BR>var autoComplete=function(o){<BR> var handler=( =function(e,o){ return new handler.prototype.init(e,o); };/* 為每個選擇的dom都建立一個相對應的對象,這樣選擇多個dom時可以很方便地使用*/<BR> handler.prototype={<BR> e:null, o:null, timer: it:function(e,o){/ * 設定初始物件*/<BR> this.e=e, this.o=o,<BR> 🎜> this.popup =this.e.getElementsByTagName(this.o.popup)[0],<BR> this.initEvent();/* match:function(quickExpr,value, source){/* 產生提示*/<BR> var li = null;<BR> if( value.length>0 && quickExpr.exec(source[i])!= null ){<BR> li = document.createElement li.innerHTML = <a href="javascript:;"> source[i] ;<BR> }li);<BR> }<BR> if(this.popup.getElementsByTagName(a).length)<BR> > this.popup .style.display=none;<BR> },<BR> &n <BR><BR></script> </div>