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

|
网页之跑马灯文字特效
//修改宽度
. }" R: k. n" |% E9 N! M5 w- Jvar marqueewidth=300' t: J9 @' u- c" X' f
//高度* {( k% }. c7 B* K8 T. F8 A
var marqueeheight=258 u: F9 Z8 Z1 f" |* T
//速度(1-10)
; R# y1 _. T& Q0 h$ ^! a" Q' fvar marqueespeed=3
. ?8 g+ e/ p/ w t1 v/ b( G//背景颜色: u5 q2 @8 q1 d. z
var marqueebgcolor="#FFFFFF"
. n$ J* q/ h5 S$ _" z2 i1 w. a//是否能暂停 (0=no. 1=yes)?5 b: g8 o$ r! X0 c
var pauseit=1
6 A3 |' o4 d# Y' L
0 q6 ~. O: _. {& n//修改显示内容
T4 _1 S& Y% A4 A8 mvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
2 X' ~ l0 Y5 r- K* z* @( v% @# c4 K
0 E) _( w7 T: _7 t
////下面不需改变////////////
+ h4 y( \" p4 J9 ?* j( j
. |2 F' `$ k& m8 N" bvar copyspeed=marqueespeed$ ]: a% t+ X& B* R* Z: @, V
var pausespeed=(pauseit==0)? copyspeed: 05 A0 `1 n3 T T) h- T
var iedom=document.all||document.getElementById$ n: u( W5 }, ~( T% D/ `% V
if (iedom)
* n# n8 v; p; B4 |! b1 @document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')" W! t( V4 y: ?, n
var actualwidth=''
2 v: s$ w5 p% _. Bvar cross_marquee, ns_marquee# M0 M( m$ N9 K+ g% t$ D h
- i" o) {$ V% p4 X, J1 mfunction populate(){1 o! i: \! `0 X( h, ]- [( ^- p
if (iedom){
+ B4 |* o2 T5 scross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
6 H" Z) z" k( I4 K0 h4 wcross_marquee.style.left=marqueewidth+8" {' d9 C0 a) P0 r. X& U0 A0 k
cross_marquee.innerHTML=marqueecontent
0 `( k& X# u% Z9 Vactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth* d/ [0 u8 ^6 v# B
}* x/ T7 k: E# S+ D2 A! G! v6 ~7 W
else if (document.layers){
* O d# P8 w, ~6 G, u/ z- Fns_marquee=document.ns_marquee.document.ns_marquee2
! B# y; \( _7 Wns_marquee.left=marqueewidth+8' ?: T3 \2 N* \- w, v
ns_marquee.document.write(marqueecontent) |/ Y- i6 ~. A
ns_marquee.document.close(): [, r- M8 K; z( o7 n* s9 @
actualwidth=ns_marquee.document.width" D# d' X2 S! P8 q& Q
}
/ e" u; k3 Z5 u N) y, R; alefttime=setInterval("scrollmarquee()",20)
0 m+ y/ z, b# y7 k( i Z} y. b0 D l) _! c% x
window.onload=populate
5 v" X9 f) ^. ~+ D# x/ w$ B4 K7 V
& s& W) d. ]) g9 P+ @& J3 pfunction scrollmarquee(){/ i6 O$ z( _/ j) ~
if (iedom){3 n/ I5 f8 p* B0 Q+ B `
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
1 j( L; u* z- }% z3 ycross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed6 h$ ^' ?- p$ L' ~5 U. }
else# Z7 E* ]3 \& C2 [/ G( q% G3 B5 p
cross_marquee.style.left=marqueewidth+8. L% \! }$ ?$ r8 X) b/ ^
# x& f- S2 i, b) l( w* D
}3 {8 `; Y; o& E% j; J; r& Z
else if (document.layers){8 V, d$ Q9 `1 c: Q
if (ns_marquee.left>(actualwidth*(-1)+8))8 N6 E* C n1 Z3 a, a, `
ns_marquee.left-=copyspeed. \1 ]1 v5 x" X& H2 T6 p
else- W/ b+ P, m+ v6 F: b/ E* h. U
ns_marquee.left=marqueewidth+8
* u6 E3 \ F7 J0 C! l7 F}
/ {" E' d2 w; i- f/ w}% p$ c& }; Z: ^5 b* L
* b3 a& N0 }7 z; Y0 H
if (iedom||document.layers){
$ H. c0 U8 V; z t4 L5 s: Ewith (document){
* ^* o9 c$ B! x- z& Fdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
4 w$ i5 @ X7 e0 U1 j. K' C& s; d9 eif (iedom){6 \+ P/ Y# ?' R( P% {- F
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
8 [& k1 U7 k6 r2 kwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')5 O( l1 N$ r& T/ h3 y' _
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
" h6 [1 B6 ]% R" U. ? `' q, mwrite('</div>')
+ l2 j$ j( G; z}
% ^' g" z0 ^! j$ velse if (document.layers){& } a; G. i5 E W
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')" C( v4 h# R6 W- \6 k
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
: ?/ X2 _5 F) {3 Q5 C& k$ {write('</ilayer>')! [% c8 b! I0 n$ |3 X9 h
}4 T. t& ~, e. F6 {! {) L$ }
document.write('</td></table>')6 a2 P% J3 F1 [
}
- X( @) E# ]6 y' A0 z t}
. Y$ e0 k, p0 B0 w9 g1 b</script> |
|