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

|
网页之跑马灯文字特效
//修改宽度% ^" c R! B0 i
var marqueewidth=300
S+ B( v' |! a9 i9 g7 ]# x( b1 c//高度
: _# Y& }% {8 v5 Uvar marqueeheight=25
2 w) y8 y/ E: A# U, J% o//速度(1-10)+ X: W: }4 L6 G# u! g; l/ X
var marqueespeed=38 {- t6 Z- z+ N' J
//背景颜色6 h* }3 }: n0 I4 F( g
var marqueebgcolor="#FFFFFF"$ \( {9 Y$ L/ |9 K7 g6 I( T
//是否能暂停 (0=no. 1=yes)?
) ]7 }% d- L) nvar pauseit=1- ]8 Z3 I% O' W! v8 A- F" {7 o( @$ H
4 Y( x+ ` {. I' e* U& {
//修改显示内容9 j9 h0 F6 {6 L3 D% C& g* p: B
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'7 m# K+ b( _+ g3 s! G2 z
! X+ f" r2 y1 o. G; v
6 z& Q; E* ^2 d7 X
////下面不需改变////////////" V" t) _$ i8 |# J$ q- I
+ |3 s' s3 ]8 J" ?" b1 v/ q1 ^) Wvar copyspeed=marqueespeed& l9 m( \2 W# p- ~; L' G
var pausespeed=(pauseit==0)? copyspeed: 0
# I& X) l4 C& t2 q, E# B' uvar iedom=document.all||document.getElementById
4 m0 H2 W1 G' G& x6 cif (iedom)0 ?) T3 D! X; B& r; c
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
& Z, {! L$ {; q& B+ r8 }$ n7 Y' H; kvar actualwidth=''2 r" Q6 F6 R3 v5 y( W/ J
var cross_marquee, ns_marquee5 v' ^4 R3 L* J
& N7 t, B- q& f- h3 m/ g/ M5 ]5 }
function populate(){& U; t- v& x* }/ s2 X
if (iedom){
2 r$ f; R" v6 K/ F: q* Ecross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee; C" y3 i( d1 x) W% e( @7 B
cross_marquee.style.left=marqueewidth+8& s r( P2 q0 H& Q$ y) Y* U4 q
cross_marquee.innerHTML=marqueecontent' G8 ]' K+ M$ t( K
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
& C" R. M/ O4 x; u1 T}
$ J1 E# K( \& U$ Z8 v5 relse if (document.layers){
: ]" [% L7 B; c: q: Dns_marquee=document.ns_marquee.document.ns_marquee2
6 Q; m( U5 b0 F2 z' |ns_marquee.left=marqueewidth+8
! D- N8 o0 Q' g3 v1 dns_marquee.document.write(marqueecontent)
/ j b0 T( w4 k5 ?5 o% H+ Bns_marquee.document.close()! a/ e! Y1 F m, g) N/ h
actualwidth=ns_marquee.document.width
, r8 Z9 P! |/ U% l8 F% G( D}
8 e( t! Y) Q0 G# {% j3 V6 wlefttime=setInterval("scrollmarquee()",20)9 Z5 o6 S/ q- Q P/ Q( k( p
}
+ U+ a0 A! {% K9 f5 gwindow.onload=populate7 w+ m' R5 w0 Y' T2 S: p
2 Z: o; w: b7 S% t! c% j( Rfunction scrollmarquee(){
. u9 I1 `8 H1 N1 }5 Q% V% ]if (iedom){. ]% X1 x: Z+ T* J1 x7 C
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
1 N& ^$ g! k0 x/ C2 o g& U/ ucross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
3 N. P9 R# p% ?7 L3 q6 T0 K+ v! P! ~else/ J/ n! m. F* P9 ]
cross_marquee.style.left=marqueewidth+8
2 S# U" ?. _0 N, r& L+ I0 l3 _! z- f. f7 Z/ Y
}
/ o( L& [" E; p& X8 Melse if (document.layers){* a6 q& k. p7 H W3 ]7 {
if (ns_marquee.left>(actualwidth*(-1)+8))
5 o* R- j' ^( c' {ns_marquee.left-=copyspeed
3 B/ M9 d. g: x: o( b5 x& L' eelse0 x* F$ s% V8 W
ns_marquee.left=marqueewidth+8
6 \4 ~, ?8 @4 ]0 q p}
( J1 S3 l8 K4 f" C% M; j1 q}: s# K \8 n2 N6 s% q$ `9 R
( U! o4 M' H' w- r- k7 `
if (iedom||document.layers){
% \0 ~0 T: d& x; _! B6 ?: V$ ?with (document){
# |+ }# F$ E |4 mdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')" D5 L2 Z$ ^$ m0 ~1 V7 J0 I* U
if (iedom){
% V2 v7 f; s7 e; }& ~write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
! j+ J5 Y! T( N! Xwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')0 E4 Y- K6 W8 S8 j K
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')1 ?) g* B- T9 ]$ n% n8 F
write('</div>')
3 b0 J/ Z$ P$ N}
# A5 [7 M% W; J0 t3 k4 ^else if (document.layers){
8 X% o9 I2 k1 v A! W6 |: _5 \write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'), C. h; w$ j' ~( ^
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
" G2 M/ d+ @; Lwrite('</ilayer>')" `/ a+ G. m3 \9 T# s+ `
}
e C& d' n% O+ l: H$ z& _. V- M4 }document.write('</td></table>'). m1 M' \) z$ c q+ m% ~3 z3 v, |" u
}( |: d+ {$ B \3 ?4 T1 ~+ W- d$ ~
}
. I+ u$ J& {( V4 c8 v% b; f) O</script> |
|