透過變更按鈕的顯示樣式,來實現按鈕動態滑動 複製程式碼 程式碼如下: 程式碼如下: 無標題文件 <br><br>.search{ background:#008800; color:#fff; border:none ; height:26px; line-height:20px; width:63x;} <BR>.searchhover{background:#000099; color:#fff; border:none; height:26px; line-height:20px; width:63; height:26px; line-height:20px; width:63 } <BR> <BR><BR>function js() <BR>{ <BR>// 使ie6 button支援hover屬性obj是要支援hover的實體hover是btn:hover的樣式,init是初始樣式<BR>obj="btn"; <BR>alert(navigator.appName); <BR>if(navigator.appName == "Microsoft Internet Explorer" && parseFloat(navigator.appVersion) == 4) {// 判斷ie6 <BR>var o = document.getElementsByName(obj); <BR>for(var i=0;i<o.length;i ){ <BR>if(o[i].type == "button"){ <BR>//o[i].className = "search"; <BR>o[i].onmouseover = function(){ this.className = "searchhover"} <BR>o[i] .onmouseout = function(){ this.className = "search"}; <BR>} <BR>} <BR>} <BR>}