提示:您可以先修改部分代碼再運行
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>淡入淡出的文本幻燈切換javascript代碼</title><meta http-equiv="content-type" content="text/html;charset=gb2312"><!--把下面代碼加到<head>與</head>之間--><style type="text/css">#memoryticker{background-color: lightyellow;width: 450px;font: bold 12px Verdana;/*Tip: add in height attribute here for multiple line scroller*/border: 1px solid black;padding: 3px;/*Change 0.7 below to a different number if desired (0.7=0.7 seconds)*//*Remove below line to remove transitional effect in IE. Below line should always appear last within this CSS*/filter: progid:DXImageTransform.Microsoft.GradientWipe(GradientSize=1.0 Duration=0.7)}</style></head><body><!--把下面代碼加到<body>與</body>之間--><script type="text/javascript">//configure tickercontents[] to set the messges you wish be displayed (HTML codes accepted)//Backslash any apostrophes within your text (ie: I'm the king of the world!)var tickercontents=new Array()tickercontents[0]='1) 網頁特效 - JavaScript tutorials and scripts.'tickercontents[1]='2) 網頁代碼 - Web coding and development forums.'tickercontents[2]='3) 特效園地 - Award winning, original DHTML scripts.'tickercontents[3]='4) 網頁製作 - Free Java applets, tutorials, and resources.'var persistlastviewedmsg=1 //should messages order persist after users navigate away (1=yes, 0=no)?var persistmsgbehavior="onload" //set to "onload" or "onclick".//configure the below variable to determine the delay between ticking of messages (in miliseconds):var tickdelay=3000//Do not edit pass this linevar divonclick=(persistlastviewedmsg && persistmsgbehavior=="onclick")? 'onClick="savelastmsg()" ' : ''var currentmessage=0function changetickercontent(){if (crosstick.filters && crosstick.filters.length>0)crosstick.filters[0].Apply()crosstick.innerHTML=tickercontents[currentmessage]if (crosstick.filters && crosstick.filters.length>0)crosstick.filters[0].Play()currentmessage=(currentmessage==tickercontents.length-1)? currentmessage=0 : currentmessage+1var filterduration=(crosstick.filters&&crosstick.filters.length>0)? crosstick.filters[0].duration*1000 : 0setTimeout("changetickercontent()",tickdelay+filterduration)}function beginticker(){if (persistlastviewedmsg && get_cookie("lastmsgnum")!="")revivelastmsg()crosstick=document.getElementById? document.getElementById("memoryticker") : document.all.memorytickerchangetickercontent()}function get_cookie(Name) {var search = Name + "="var returnvalue = ""if (document.cookie.length > 0) {offset = document.cookie.indexOf(search)if (offset != -1) {offset += search.lengthend = document.cookie.indexOf(";", offset)if (end == -1)end = document.cookie.length;returnvalue=unescape(document.cookie.substring(offset, end))}}return returnvalue;}function savelastmsg(){document.cookie="lastmsgnum="+currentmessage}function revivelastmsg(){currentmessage=parseInt(get_cookie("lastmsgnum"))currentmessage=(currentmessage==0)? tickercontents.length-1 : currentmessage-1}if (persistlastviewedmsg && persistmsgbehavior=="onload")window.onunload=savelastmsgif (document.all||document.getElementById)document.write('<div id="memoryticker" '+divonclick+'></div>')if (window.addEventListener)window.addEventListener("load", beginticker, false)else if (window.attachEvent)window.attachEvent("onload", beginticker)else if (document.all || document.getElementById)window.onload=beginticker</script></body></html></td> </tr></table>
提示:您可以先修改部分代碼再運行