Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

asp網頁語法問題(訊息跑馬燈)

我要問的就是類似這個網站天翼之鍊官網(http://tw.digicell.com.tw/)

右上角的那個公告會向上捲動的asp語法

不知道有沒有大大會@@"

麻煩告知一下>"<

2 Answers

Rating
  • Anonymous
    2 decades ago
    Favorite Answer

    =============這是另一種向上捲的功能,修改方式很簡單===============

    <!--語法在網頁插入的開始-->

    <div align="center">

    <center>

    <!--流動公告欄外框的色彩及大小//-->

    <table border="1" cellspacing="0" width="240" bordercolor="#FF9900" cellpadding="0">

    <tr>

    <td align="center" valign="middle" background="pic/b.jpg" class="style2">title</td>

    </tr>

    <tr>

    <td width="200" valign="middle" align="center"><div align="center">

    <table border="0" cellspacing="1" width="200">

    <tr>

    <td width="176"><div align="center">

    <SCRIPT language=JavaScript>

    <!--//

    var version = "other"

    browserName = navigator.appName;

    browserVer = parseInt(navigator.appVersion);

    if (browserName == "Netscape" && browserVer >= 3) version = "n3";

    else if (browserName == "Netscape" && browserVer < 3) version = "n2";

    else if (browserName == "Microsoft Internet Explorer" && browserVer >= 4) version = "e4";

    else if (browserName == "Microsoft Internet Explorer" && browserVer < 4) version = "e3";

    function marquee1()

    {

    if (version == "e4")

    {

    <!--在這裡可以修改公告欄內容顯示的寬度﹑高度﹐滾動的速度與方向﹐每次滾動後的之間停頓的時間//-->

    document.write("<marquee behavior=scroll direction=up width=200 height=150 scrollamount=1 scrolldelay=20 onmouseover='this.stop()' onmouseout='this.start()'>")

    }}

    function marquee2()

    {

    if (version == "e4")

    {

    document.write("</marquee>")

    } }

    //-->

    </SCRIPT>

    <SCRIPT language=JavaScript>marquee1();</SCRIPT>

    <table border="0" cellspacing="1" width="100%">

    <tr>

    <td><!--在這裡你可以在<div>與</div>之間放置其它欲滾動顯示的內容//-->

    <div align="center">

    <center>

    <table border="0" cellspacing="5" width="100%">

    <tr>

    <td width="100%" class="style0">測試</td>

    </tr>

    <tr>

    <td class="style2">test</td>

    </tr>

    <tr>

    <td width="100%" class="style1">測試</td>

    </tr>

    <tr>

    <td width="100%">測試 <img src="pic/trals.gif" width="115" height="25"></td>

    </tr>

    </table>

    </center>

    </div>

    <!--在這裡你可以在<div>與</div>之間放置其它欲滾動顯示的內容//-->

    </td>

    </tr>

    </table>

    </div></td>

    </tr>

    </table>

    </div></td>

    </tr>

    </table>

    </center>

    </div>

    <!--語法在網頁插入的結束-->

    ========================================================

    之前PO的

    ========================================================

    <html>

    <head>

    <meta name="GENERATOR" content="Microsoft FrontPage 5.0">

    <meta name="ProgId" content="FrontPage.Editor.Document">

    <meta http-equiv="Content-Type" content="text/html; charset=big5">

    <title>新增網頁1</title>

    <script language="JavaScript">

    <!--

    var no=0, etLeftMargin=580, etMainWidth=750;

    var eventsTickerID, isNavRunning = false;

    var isNav = (navigator.appName.indexOf("Netscape") !=-1);

    // reset the position of division

    function hResetX(e) {

    if (isNav) {

    //isNavRunning = false;

    x = etLeftMargin + Math.floor((window.outerWidth - etMainWidth) / 2);

    x = (x < etLeftMargin) ? etLeftMargin : x;

    document.wds.left = x;

    //window.reload();

    }

    }

    function hLoad(e) {

    if (!isNavRunning) {

    isNavRunning = true;

    eventsTickerID = setTimeout("EventsTicker();", 500);

    }

    if (isNav) {

    window.captureEvents(Event.RESIZE);

    window.onresize = hResetX;

    }

    }

    function EventsTicker() {

    desc = "<a href=\"" + EventsURL[no] + "\" style=\"text-decoration: none; font-size: 9pt;\"><font color=blue>" + EventsDesc[no] + "</font></a>";

    if(isNav) {

    document.wds.document.write(desc);

    document.wds.document.close();

    } else {

    wds.innerHTML = desc;

    }

    no = (no >= EventsDesc.length-1) ? 0 : ++no;

    eventsTickerID = setTimeout("EventsTicker();", 2500);

    }

    //EventsTicker();

    //eventsTickerID = setTimeout("EventsTicker();", 200);

    // catch the events for my own handler

    if (document.layer) window.captureEvents(Event.LOAD);

    window.onload = hLoad;

    // -->

    </script>

    </head>

    <body>

    <SCRIPT language=JavaScript>

    scrollerwidth=534

    scrollerheight=108

    scrollerbgcolor=''

    toppause=3000

    minipause=10

    dtop=10

    decrement=1

    scrollerbackground=''

    disc_heads=new Array()

    disc_urls=new Array()

    express_heads=new Array()

    express_urls=new Array()

    disc_heads[0]='----------2005/10/4----------'

    disc_heads[1]='10/04(二)11:00遊戲伺服器開機公告'

    disc_heads[2]='----------2005/10/3----------'

    disc_heads[3]='【 10/04 (二) 07:00~11:00將進行遊戲伺服器例行性維護】'

    disc_heads[4]='----------2005/10/3----------'

    disc_heads[5]='九月份大樂透獎開獎囉~'

    disc_heads[6]='----------2005/10/3----------'

    disc_heads[7]='2005 10/03(ㄧ)違反遊戲規章名單'

    disc_heads[8]='----------2005/10/2----------'

    disc_heads[9]='10/02 (日) 13:00飛天豬伺服器臨時性停機開機公告'

    disc_urls[0]='修改連結處'

    disc_urls[1]='修改連結處'

    disc_urls[2]='修改連結處'

    disc_urls[3]='修改連結處'

    disc_urls[4]='修改連結處'

    disc_urls[5]='修改連結處'

    disc_urls[6]='修改連結處'

    disc_urls[7]='修改連結處'

    disc_urls[8]='修改連結處'

    disc_urls[9]='修改連結處'

    </SCRIPT>

    </SPAN></TD></TR></TBODY></TABLE>

    <SCRIPT language=JavaScript >

    disc_news_url=""

    express_news_url=""

    disc_source_text=""

    express_source_text=""

    source_font="<font color=#336600 class=small>"

    messages=new Array()

    function write_message( mindex, top_url, top_text, urlarray, textarray, index ) {

    messages[ mindex ] = source_font + top_text + "<br><a href='" + urlarray[index] + "'>" + textarray[index] + "</a><br>";

    if ( textarray[ index +1 ] )

    messages[ mindex ] += "<br><a href='" + urlarray[index +1] + "'>" + textarray[index + 1] + "</a>";

    messages[ mindex ] += "</font>"

    }

    mess_len = ( disc_heads.length + (disc_heads.length % 2) + express_heads.length + (express_heads.length % 2)) / 2 ;

    for (d=0, m=0, e=0; m<=(mess_len-1); m++) {

    if ( disc_heads[d] ) {

    write_message( m, disc_news_url, disc_source_text, disc_urls, disc_heads, d );

    d += 2;

    } else if ( express_heads[e] ) {

    write_message( m, express_news_url, express_source_text, express_urls, express_heads, e );

    e += 2;

    }

    }

    if (messages.length>1) {

    i=2

    if ( i >= messages.length )

    i = 0;

    }

    else

    i=0

    function move1(whichlayer){

    tlayer=eval(whichlayer)

    if (tlayer.top>0&&tlayer.top<=dtop){

    tlayer.top=0

    setTimeout("move1(tlayer)",toppause)

    setTimeout("move2(document.main.document.second)",toppause)

    return

    }

    if (tlayer.top>=tlayer.document.height*-1){

    tlayer.top-=decrement

    setTimeout("move1(tlayer)",minipause)

    } else {

    tlayer.top=scrollerheight

    tlayer.document.write(messages[i])

    tlayer.document.close()

    if (i==messages.length-1)

    i=0

    else

    i++

    }}

    function move2(whichlayer){

    tlayer2=eval(whichlayer)

    if (tlayer2.top>0&&tlayer2.top<=dtop){

    tlayer2.top=0

    setTimeout("move2(tlayer2)",toppause)

    setTimeout("move1(document.main.document.first)",toppause)

    return

    }

    if (tlayer2.top>=tlayer2.document.height*-1){

    tlayer2.top-=decrement

    setTimeout("move2(tlayer2)",minipause)

    }

    else{

    tlayer2.top=scrollerheight

    tlayer2.document.write(messages[i])

    tlayer2.document.close()

    if (i==messages.length-1)

    i=0

    else

    i++

    }

    }

    function move3(whichdiv){

    tdiv=eval(whichdiv)

    if (tdiv.style.pixelTop>0&&tdiv.style.pixelTop<=dtop){

    tdiv.style.pixelTop=0

    setTimeout("move3(tdiv)",toppause)

    setTimeout("move4(second2)",toppause)

    return

    }

    if (tdiv.style.pixelTop>=tdiv.offsetHeight*-1){

    tdiv.style.pixelTop-=decrement

    setTimeout("move3(tdiv)",minipause)

    }

    else{

    tdiv.style.pixelTop=scrollerheight

    tdiv.innerHTML=messages[i]

    if (i==messages.length-1)

    i=0

    else

    i++

    }

    }

    function move4(whichdiv){

    tdiv2=eval(whichdiv)

    if (tdiv2.style.pixelTop>0&&tdiv2.style.pixelTop<=dtop){

    tdiv2.style.pixelTop=0

    setTimeout("move4(tdiv2)",toppause)

    setTimeout("move3(first2)",toppause)

    return

    }

    if (tdiv2.style.pixelTop>=tdiv2.offsetHeight*-1){

    tdiv2.style.pixelTop-=decrement

    setTimeout("move4(second2)",minipause)

    }

    else{

    tdiv2.style.pixelTop=scrollerheight

    tdiv2.innerHTML=messages[i]

    if (i==messages.length-1)

    i=0

    else

    i++

    }}

    function startscroll(){

    // add for eventticker.js

    //hLoad();

    if (document.all){

    move3(first2)

    second2.style.top=scrollerheight

    second2.style.visibility='visible'

    }

    else if (document.layers){

    document.main.visibility='show'

    move1(document.main.document.first)

    document.main.document.second.top=scrollerheight+decrement

    document.main.document.second.visibility='show'

    }

    }

    </SCRIPT>

    <SCRIPT language=JavaScript

    type=text/javascript>

    window.onload=startscroll

    </SCRIPT>

    <ILAYER id=main

    background="&amp;%7Bscrollerbackground%7D;"

    bgColor="&amp;{scrollerbgcolor};"

    visibility="hide"

    height="&amp;{scrollerheight};"

    width="&amp;{scrollerwidth};" z-index="2"><LAYER

    id=first width="&amp;{scrollerwidth};"

    z-index="1" top="1" left="0">

    <SCRIPT language=JavaScript>

    if (document.layers) document.write(messages[0]);

    </SCRIPT>

    </LAYER><LAYER id=second visibility="hide"

    width="&amp;{scrollerwidth};" z-index="2"

    top="0" left="0">

    <SCRIPT language=JavaScript>

    if (document.layers) document.write(messages[1]);

    </SCRIPT>

    </LAYER></ILAYER>

    <SCRIPT language=JavaScript>

    if (document.all){

    document.writeln('<span id="main2" style="position:relative;width:'+scrollerwidth+';height:'+scrollerheight+';overflow:hiden;background-color:'+scrollerbgcolor+' ;background-image:url('+scrollerbackground+')">');

    document.writeln('<div style="position:absolute;width:'+scrollerwidth+';height:'+scrollerheight+';clip:rect(0 '+scrollerwidth+' '+scrollerheight+' 0);left:0;top:0">');

    document.writeln('<div id="first2" style="position:absolute;width:'+scrollerwidth+';left:0;top:1;">');

    document.write(messages[0]);

    document.writeln('</div>');

    document.writeln('<div id="second2" style="position:absolute;width:'+scrollerwidth+';left:0;top:0;visibility:hidden">');

    document.write(messages[1]);

    document.writeln('</div>');

    document.writeln('</div>');

    document.writeln('</span>');

    }

    </SCRIPT>

    </body>

    </html>

  • 2 decades ago

    謝謝大大的提供…

    可是小弟是要把公告的東西用資料庫的方式表現出來@@"

    這個感覺好像寫死在頁面的~"~

    不知道大大會不會用

    VbScript的方式呈現出來?>"<

    麻煩大大了…再次thx

Still have questions? Get your answers by asking now.