博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
一个文字横向滚动的JavaScript文档
阅读量:6997 次
发布时间:2019-06-27

本文共 2613 字,大约阅读时间需要 8 分钟。

<html xmlns="http://www.w3.org/1999/xhtml">

<head>
    <title></title>
    <script language="JavaScript">
 
with (top.window.location)
{baseURL = href.substring (0,href.lastIndexOf ("/") + 1)}
total_toc_items = 0;
current_overID = "";
last_overID = "";
browser = navigator.appName;
version = parseInt(navigator.appVersion);
client=null;
loaded = 0;
if (browser == "Netscape" && version >= 3) client = "ns3";
function toc_item (img_name,icon_col,width,height) {
if (client =="ns3") {
img_prefix = baseURL + img_name;
this.icon_col = icon_col;
this.toc_img_off = new Image (width,height);
this.toc_img_off.src = img_prefix + "_off.gif";
this.toc_img_on = new Image (width,height);
this.toc_img_on.src = img_prefix + "_on.gif";
}
}
 
function new_toc_item (img_name,icon_row,width,height) {
toc_item [img_name] = new toc_item (img_name,icon_row,width,height);
}
 
function toc_mouseover (itemID) {
if (client =="ns3") {
current_overID = itemID;
if (current_overID != last_overID) {
document [current_overID].src = toc_item [current_overID].toc_img_on.src;
if (last_overID != "") {
document.images [last_overID].src = toc_item[last_overID].toc_img_off.src;
}
last_overID = current_overID;
}
}
}
 
function toc_mouseout () {
if (client =="ns3") {
if (current_overID != "") {
document.images [current_overID].src = toc_item [current_overID].toc_img_off.src;
}
current_overID = "";
last_overID = "";
}
}
new_toc_item ("1",2,120,20);
<!-- Begin
function bannerObject(p){
this.msg = MESSAGE
this.out = " "
this.pos = POSITION
this.delay = DELAY
this.i = 0
this.reset = clearMessage}
 
function clearMessage(){
this.pos = POSITION}
var POSITION = 50;
var DELAY = 150;
var MESSAGE = "这是一个动态JavaScript文字显示的例子";
var scroll = new bannerObject();
function scroller(){
scroll.out += " ";
if(scroll.pos>0)
for (scroll.i = 0; scroll.i < scroll.pos; scroll.i++) { scroll.out +=" " ; }
if (scroll.pos>= 0)
scroll.out += scroll.msg
else
scroll.out = scroll.msg.substring(-scroll.pos,scroll.msg.length)
document.noticeForm.notice.value = scroll.out
scroll.out = " ";
scroll.pos--;
scroll.pos--;
if (scroll.pos < -(scroll.msg.length)) { scroll.reset(); } setTimeout
('scroller()',scroll.delay);}
    </script>
</head>
<body οnlοad="scroller()" bgcolor="#000000" link="#C0C0C0" vlink="#C0C0C0" alink="#008080"
    text="#C0C0C0">
    <table border="0" cellspacing="0" cellpadding="0">
        <tr>
            <td width="100%">
                <form name="noticeForm">
                <p>
                    <input type="text" name="notice" size="40" style="background-color: rgb(192,192,192)"></p>
                </form>
            </td>
        </tr>
    </table>
    </center></div>
</body>
</html>

转载于:https://www.cnblogs.com/dc-learn/archive/2013/01/22/2871257.html

你可能感兴趣的文章