⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 8.12 带链接的滚动字幕.htm

📁 一些javascript的小例子希望对初学者有更好的帮助
💻 HTM
字号:
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>标题页</title>
</head>
<body>
<script language="JavaScript1.2">
var marqueewidth=400  //设置marquee的宽度 (in pixels)
var marqueeheight=20  //设置marquee的高度 (in pixels, 该参数只适用于Netscape)
var speed=4           //设置marquee滚动的速度(数值越大速度越快)
//设置marquee显示内容,使用标准的HTML语法。
var marqueecontents='<strong><big>欢迎支持中国搜索引擎 <a href="http://www.baidu.com">百度一下</a> 找到自己想找的 信息</big></strong></font>'
if (document.all)
document.write('<marquee scrollAmount='+speed+' style="width:'+marqueewidth+'">'+marqueecontents+'</marquee>')
function regenerate(){
    window.location.reload();                     //重新加载页面
}
function regenerate2(){
    if (document.layers){
    setTimeout("window.onresize=regenerate",450);//窗体改变大小时重载
    intializemarquee();
    }
}
function intializemarquee(){
   //使用nobr控制显示的字符个数
    document.cmarquee01.document.cmarquee02.document.write('<nobr>'+marqueecontents+'</nobr>');
    document.cmarquee01.document.cmarquee02.document.close();
    thelength=document.cmarquee01.document.cmarquee02.document.width;  //获取层的宽度
    scrollit();                                                        //实现字体的滚动
}
function scrollit(){
        if (document.cmarquee01.document.cmarquee02.left>=thelength*(-1)){
        document.cmarquee01.document.cmarquee02.left-=speed;
        setTimeout("scrollit()",100);                       //定时器实现不停的调用
    }
    else{
        document.cmarquee01.document.cmarquee02.left=marqueewidth;
        scrollit();
    }
}
window.onload=regenerate2;
</script>
<ilayer width=&{marqueewidth}; height=&{marqueeheight}; name="cmarquee01"> 
<layer name="cmarquee02"></layer>
</ilayer>
</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -