Q: 實(shí)現(xiàn)雙擊自動(dòng)滾屏.
A: 將以下代碼添加到需要自動(dòng)滾屏的頁(yè)面上
<s cript Language="Javas cript">
var currentpos, timer;
function initialize(){
timer = setInterval("scrollwindow()", 1);
}
function sc(){
clearInterval(timer);
}
function scrollwindow(){
currentpos = document.body.scrollTop;
window.scroll(0, ++currentpos);
if(currentpos != document.body.scrollTop){
sc();
}
}
document.onmousedown = sc;
document.ondblclick = initialize;
</s cript>
Q: 鼠標(biāo)特效 。
A: 鼠標(biāo)放到鏈接上就會(huì)出現(xiàn)一個(gè)說(shuō)明框,里面有滾動(dòng)的文字說(shuō)明
<a target="_blank" onMouseOver="helpor_net_show(this,event,' 這里是小郭的個(gè)人主頁(yè) ')" onMouseOut="helpor_net_hide()"> 把鼠標(biāo)放上來(lái)試試
<div id="tooltip2" style="position:absolute;visibility:hidden;clip:rect(0 150 50 0);width:150px;background-color:seashell">
<layer name="nstip" width="1000px" bgColor="seashell"></layer>
</div>
<SCRIPT language="JavaScript">
<!--
if (!document.layers&&!document.all)
event="test"
function helpor_net_show(current,e,text){
if (document.all&&document.readyState=="complete"){
document.all.tooltip2.innerHTML='<marquee style="border:1px solid #3399ff">'+text+'</marquee>'
document.all.tooltip2.style.pixelLeft=event.clientX+document.body.scrollLeft+10
document.all.tooltip2.style.pixelTop=event.clientY+document.body.scrollTop+10
document.all.tooltip2.style.visibility="visible"
}
else if (document.layers){
document.tooltip2.document.nstip.document.write(' '+text+' ')
document.tooltip2.document.nstip.document.close()
document.tooltip2.document.nstip.left=0
currentscroll=setInterval("scrolltip()",100)
document.tooltip2.left=e.pageX+10
document.tooltip2.top=e.pageY+10
document.tooltip2.visibility="show"
}
}
function helpor_net_hide(){
if (document.all)
document.all.tooltip2.style.visibility="hidden"
else if (document.layers){
clearInterval(currentscroll)
document.tooltip2.visibility="hidden"
}
}
function scrolltip(){
if (document.tooltip2.document.nstip.left>=-document.tooltip2.document.nstip.document.width)
document.tooltip2.document.nstip.left-=5
else
document.tooltip2.document.nstip.left=150
}
//-->
</SCRIPT>
Q: 文本隨機(jī)輸出,可以用來(lái)作公告欄 。
A: 腳本說(shuō)明 :
第一步 : 把如下代碼加入 <head> 區(qū)域中
<SCRIPT LANGUAGE="JavaScript">
<!-- Original: Tarjei Davidsen ([email protected]) -->
<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->
<!-- Begin
新聞熱點(diǎn)
疑難解答
圖片精選