返回列表 发帖

网页之跑马灯文字特效

//修改宽度3 E9 D  _4 Q) B( d7 j
var marqueewidth=3005 H7 N* S0 F% b! f+ _, c, X
//高度
$ ]( }$ C+ ~( j! e# N$ \* k" cvar marqueeheight=258 Y: A! M1 O# t8 O
//速度(1-10)2 u1 K$ B$ L% X7 y
var marqueespeed=3: V$ ^5 m* R$ B
//背景颜色8 J: R% L1 G; u/ |2 Y( {# a8 \5 `
var marqueebgcolor="#FFFFFF"" X; H! X) l. N6 C; p2 I; d; I5 c
//是否能暂停 (0=no. 1=yes)?2 \: K+ i% @& {; D7 @& i! u
var pauseit=1
& N9 v7 c4 {4 I" j: v. ~& w
$ X: w5 j. ^5 n! I0 A//修改显示内容
* a7 n  w+ _, Mvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
& K- v" _2 h- z# Z- F8 I  U7 z
: a+ |# L. X* s3 V9 S2 [% }. ]' ~: Y7 ~
////下面不需改变////////////. X, W; P8 W: h4 n7 ]$ j; C% x+ p/ H

3 D* l  f  _+ B- [var copyspeed=marqueespeed( A+ z& B. }/ q+ L" k2 m
var pausespeed=(pauseit==0)? copyspeed: 0
) H$ d0 F  F* G7 [% Z2 U( Zvar iedom=document.all||document.getElementById
' L% N/ g( ]: k2 v! s5 Y6 D" oif (iedom)
; i. n# `+ @0 K& L9 _7 zdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')* L6 _) P; D/ X8 J7 b4 S& {
var actualwidth=''
, R; S& @7 ~6 Pvar cross_marquee, ns_marquee
0 [3 d( f2 k3 o) D: {* q) Z- R( f! W, u
function populate(){
/ R9 O% M* ^0 Z, l: ?5 f; Yif (iedom){
- q+ \# x% W2 }; P. ~8 Dcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
4 G, s$ c- u. Kcross_marquee.style.left=marqueewidth+8
9 u3 ^0 [- ^  ?7 x; _cross_marquee.innerHTML=marqueecontent
9 d7 \0 E9 y% Q/ Xactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth$ ?% ~4 F' ?4 {- n, H
}0 U8 R2 g3 A- x2 e$ t1 [
else if (document.layers){
2 S# n  S6 L% e! G3 \0 Hns_marquee=document.ns_marquee.document.ns_marquee2
  x7 g8 j' H7 ~! g, Hns_marquee.left=marqueewidth+8
" y, q8 t! o& o- |  F$ Vns_marquee.document.write(marqueecontent)4 r; u, J/ S4 o
ns_marquee.document.close()
9 p$ j9 p! S( e9 {! F+ ^actualwidth=ns_marquee.document.width% F* [7 i' X( ~* ^2 w1 J7 l
}& O5 R$ x& p  s" \/ T% n0 i
lefttime=setInterval("scrollmarquee()",20)
& |' ?2 L; a* y7 @; Q$ y% G( R  d# `2 f7 ~}' N& m! H. L* {/ p- J) I
window.onload=populate) V5 x! D- v# s) O- X, c
: e7 N4 w0 ~/ R& n0 q! V7 f2 O& r
function scrollmarquee(){
& k% ~4 f" j& y/ [, Hif (iedom){
5 @1 p' n# I4 I& zif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))0 {7 K; u: G8 g6 C# Q# h/ p
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
. L: N8 N% z$ j. k, h% l# {else# o% D) s8 v% B7 X" r( o' F
cross_marquee.style.left=marqueewidth+8
* S# [9 C% N; v3 {5 u! R1 |' z& P. d$ `  ~
}
6 V- N/ j, {+ `' R" L0 B2 ^) Nelse if (document.layers){
3 \2 u$ y) |6 W$ ?- T7 q$ d6 eif (ns_marquee.left>(actualwidth*(-1)+8))4 q  R7 D, H# w" Y& h; \- ^
ns_marquee.left-=copyspeed
) C6 c" a' I9 U( w* V- telse
  r+ `  q% g7 k# Rns_marquee.left=marqueewidth+8
, f; t# h2 N6 ]% [, R4 T5 k}& r2 P5 ~* o* e9 J
}' `9 V' D5 ?  N' x# u  Q

6 B: y: t/ r* ]' W1 p8 U! d4 F3 P0 Bif (iedom||document.layers){
8 e5 d& r& E) l, I; ?# j, Z: {with (document){) P, S- Q! o. w& ^) s" x
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')8 w3 ]3 ]+ E/ G; W- _! ?; ^
if (iedom){
  q) X% g8 d: p+ jwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
! A; t- p* ?5 T; r) `write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
6 P5 A7 g' R- O6 V4 i! Lwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')1 i7 ^& B3 ^8 I& T, {
write('</div>')
+ W6 T* I8 I' @/ A3 C}* u  G( `% h; f% i; L. v
else if (document.layers){' I; c/ G- K! D; E8 Y" r; o
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
4 [) B3 r- }% A( c' K: g$ ?0 @write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
3 i7 ~; F- r; h2 T8 bwrite('</ilayer>')
* T$ a1 P& W: u0 M1 E. {( u% p5 A}6 b. _9 K" |; s" r$ X0 w
document.write('</td></table>')
. E2 i' z/ J$ g9 I5 R}
+ U+ H9 M" @1 q; [! w}
# y) }$ @- Q: d  W# u7 g6 V2 W! H</script>

返回列表
【捌玖网络】已经运行: