//對聯滾動 lastScrollY=0; function heartBeat(){ var diffY; if (document.documentElement && document.documentElement.scrollTop) diffY = document.documentElement.scrollTop; else if (document.body) diffY = document.body.scrollTop else {/*Netscape stuff*/} //alert(diffY); percent=.1*(diffY-lastScrollY); if(percent>0)percent=Math.ceil(percent); else percent=Math.floor(percent); //新增范本:document.getElementById("層id").style.top=parseInt(document.getElementById("層id").style.top)+percent+"px"; lastScrollY=lastScrollY+percent; //alert(lastScrollY); } j1="
X
" j2="
X
" j3="
X
" j4="
X
" j5="
" j6="
" j7="
X
" j8="
X
" j9="
X
" j10="
X
" j11="
" j12="
" //新增范本:jn(注:n是數字,不可與上面重復)="

" document.write(j1); document.write(j2); document.write(j3); document.write(j4); document.write(j5); document.write(j6); document.write(j7); document.write(j8); document.write(j9); document.write(j10); document.write(j11); document.write(j12); //新增范本:document.write(jn);(注:n是數字,不可與上面重復) window.setInterval("heartBeat()",1); /** * JavaScript腳本實現回到頁面頂部示例 * @param acceleration 速度 * @param stime 時間間隔 (毫秒) **/ function gotoTop(acceleration,stime) { acceleration = acceleration || 0.1; stime = stime || 10; var x1 = 0; var y1 = 0; var x2 = 0; var y2 = 0; var x3 = 0; var y3 = 0; if (document.documentElement) { x1 = document.documentElement.scrollLeft || 0; y1 = document.documentElement.scrollTop || 0; } if (document.body) { x2 = document.body.scrollLeft || 0; y2 = document.body.scrollTop || 0; } var x3 = window.scrollX || 0; var y3 = window.scrollY || 0; // 滾動條到頁面頂部的水平距離 var x = Math.max(x1, Math.max(x2, x3)); // 滾動條到頁面頂部的垂直距離 var y = Math.max(y1, Math.max(y2, y3)); // 滾動距離 = 目前距離 / 速度, 因為距離原來越小, 速度是大于 1 的數, 所以滾動距離會越來越小 var speeding = 1 + acceleration; window.scrollTo(Math.floor(x / speeding), Math.floor(y / speeding)); // 如果距離不為零, 繼續調用函數 if(x > 0 || y > 0) { var run = "gotoTop(" + acceleration + ", " + stime + ")"; window.setTimeout(run, stime); } }; //返回頭部的3個圖標的hover $(".ddceng1").hover(function(){ $(this).addClass("ddceng0"); },function(){ $(this).removeClass("ddceng0"); }); $(".ddceng2").hover(function(){ $(this).addClass("ddceng0"); $(".ddceng2 .floating_left").addClass("block") },function(){ $(this).removeClass("ddceng0"); $(".ddceng2 .floating_left").removeClass("block") }); $(".ddceng3").hover(function(){ $(this).addClass("ddceng0"); },function(){ $(this).removeClass("ddceng0"); });