|
  
- UID
- 133
- 帖子
- 51
- 精华
- 1
- 积分
- 186
- 金币
- 55
- 威望
- 2
- 贡献
- 0

|
网页之跑马灯文字特效
//修改宽度5 o; K7 U1 l8 O. m* [1 ?0 |- q
var marqueewidth=300
) _7 R3 H; h$ U8 F" T//高度8 f& J" `# O( ^8 h
var marqueeheight=25 [5 [% @6 F5 T, S
//速度(1-10)" _$ S4 e# C' O. X l- |
var marqueespeed=3
4 b+ g- ~7 _& K! t! O0 i8 Q3 V8 {//背景颜色
1 t5 Z9 f0 w. I$ {0 Bvar marqueebgcolor="#FFFFFF"% Y% {7 L3 p1 K& e* ]0 _
//是否能暂停 (0=no. 1=yes)?
9 q* S# D: J3 S- R' S: V* hvar pauseit=1
7 i$ Q9 o" }* g7 ?+ G( `7 o, D2 z8 ~& c6 { Q
//修改显示内容
: I, ^3 J) Z/ evar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'4 _+ I$ W E% U, D2 n# @4 f0 h
( n3 Q& x: O4 P! _4 w3 d
* c* q+ P+ q# K. P
////下面不需改变////////////
/ a9 d3 J* a4 W% w( c9 J1 n$ I1 ]/ u2 w# D
var copyspeed=marqueespeed
: C/ y3 K* ^6 |$ o$ r3 `& pvar pausespeed=(pauseit==0)? copyspeed: 0, o1 z" F: N6 A3 R
var iedom=document.all||document.getElementById' f* w8 H" G! ^8 K; P3 V
if (iedom)
/ q3 V$ E) ^1 n9 R* Y" Y) g8 Wdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
' F3 H/ d8 J9 v5 E: ?' Ovar actualwidth=''
) Y% W$ Q4 c6 i, j9 hvar cross_marquee, ns_marquee {3 K) u) z, Q
( s' N- F7 g U
function populate(){
/ P2 Q8 N- }/ R' j& bif (iedom){
) a' R Q7 f, x( c" Q0 r0 P' ycross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
. g" E4 h" a9 O' T3 E+ Bcross_marquee.style.left=marqueewidth+8
$ `! h( C: k) wcross_marquee.innerHTML=marqueecontent
. @8 v1 x( z3 R& zactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth0 c3 l( |9 R4 Y$ O4 y& x" N
}
3 ]0 j3 C) H" x! `/ q( \else if (document.layers){
* N7 a: n& P+ o9 R0 Ens_marquee=document.ns_marquee.document.ns_marquee2
8 k& T2 u0 b5 `& N9 d. rns_marquee.left=marqueewidth+8
, K# a. P2 P2 W+ u. lns_marquee.document.write(marqueecontent)0 o: ^ w+ I* H3 ^; U! s& c
ns_marquee.document.close()
" e- v, t/ ?0 P* ractualwidth=ns_marquee.document.width
' B' z4 \9 l( F3 h* X}
5 J3 r. @8 ~9 L' f; ^' [+ O; ^. Llefttime=setInterval("scrollmarquee()",20)6 q4 e# q! A4 o1 u+ m! U2 s4 ]
}
/ w/ ^1 y. f' S% w& |0 v$ \window.onload=populate
4 {" k$ C2 D2 y, p+ S* d' K
, X/ Q/ U8 K9 e, yfunction scrollmarquee(){
+ o' {& x2 h) Rif (iedom){
7 z0 }1 f Y, W3 a& B# h6 a; F! Iif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))( g$ _4 G+ m D/ \ p) w9 B
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed) u2 X, L# Y# H/ Z4 x% l4 y: E; D
else( k Z D* q+ G$ d: v
cross_marquee.style.left=marqueewidth+88 \; X* a5 V9 e' c: U
& m7 k0 U1 G2 i/ r- E}' I% n' a6 r5 r8 A5 A* s
else if (document.layers){$ E1 E' [$ b) ^3 Q, T& U6 E
if (ns_marquee.left>(actualwidth*(-1)+8))
, U! y9 H, g/ Fns_marquee.left-=copyspeed& y. D$ n, Q& r S4 D: t
else$ R @2 X) r- N- K1 F, Q
ns_marquee.left=marqueewidth+8- ^7 w6 @: a' H. V3 `4 `: Y6 {
}, [& V/ l. B3 E6 ^# ?
}1 N# P* K3 U4 w; a/ v4 S
, C" R/ [& D: J9 B5 K
if (iedom||document.layers){
3 `+ o9 Q' i' y1 `% o3 {with (document){
% A: {, F7 t% G% d. s' Z9 U: Vdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')$ t) |" g6 R/ J: w: S9 c9 o0 W& k
if (iedom){
* M( ^( O! W6 q' p" R6 S9 w, \" K/ _write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
8 A9 a& C; L! Z6 {write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'). ~, ^0 Y) b. e* }! |/ `# \+ s
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')8 r9 ? ~) n$ w2 [5 V
write('</div>')
3 y; ^* a4 Z; V1 k}
! W# J& X7 [% d3 f0 N Yelse if (document.layers){+ ]' A4 Z" q+ b+ k0 H* t' @
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
: \5 w% [# t; T, uwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')4 s- W6 R. l8 a
write('</ilayer>'), B% [! j5 r/ n
}
8 l% m, h+ b" F; j4 ?& ydocument.write('</td></table>')# \5 ^3 @/ e4 e) f! d" G( Y4 v
}
2 s' \* n" o7 ?9 b! ]( _; Q3 H}
) \- h, [# J) c1 U5 H) N' u- U) a9 |</script> |
|