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

|
网页之跑马灯文字特效
//修改宽度
; W# {% h! _+ O( y, X; U2 d* svar marqueewidth=3002 d/ t' @9 Z: }, w
//高度/ W& U% V; }9 S0 U4 y5 \
var marqueeheight=25
6 q3 Y- E5 U2 d' a* s//速度(1-10)
) N* t/ n! k) V, {. e8 xvar marqueespeed=31 f: W% H$ o6 Z$ ?' V
//背景颜色
) r2 d- t- y" P3 n+ Gvar marqueebgcolor="#FFFFFF"3 x: J% h R* ?3 N! S6 a1 C$ @0 C( N8 c
//是否能暂停 (0=no. 1=yes)?
- @, i8 u5 j# i3 Mvar pauseit=1( P% O& `$ h6 S6 y
( A4 Z& x5 G N, G- o& @ @% v
//修改显示内容- S, R3 }/ w- [
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'+ j$ d Y& `8 h
- |! O: M. r# ~& E
( V! X: P$ v) H6 P////下面不需改变////////////% {4 X7 M4 \$ a+ R+ K- i
, Z0 |' y' d6 [ q) }/ \var copyspeed=marqueespeed( ^9 ^2 D" Q# G$ t, ^
var pausespeed=(pauseit==0)? copyspeed: 0/ b/ m9 B3 W; z2 N _. i' T
var iedom=document.all||document.getElementById6 ]2 t( U, y4 x" s4 ~
if (iedom)& {" M6 Y7 Z6 v: U2 \
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'). i$ B6 I) k% s) H& h0 l# Q8 W2 H( T; q- T
var actualwidth=''
& F4 r" e' c( _- k* x2 X% |var cross_marquee, ns_marquee. O6 u; J, B; \( `# p! I9 L) C
; ]" v" d! ~3 T/ ]) w1 ~3 F$ n
function populate(){
T1 l0 n! {' @4 ~% ^1 n% h' Fif (iedom){' G& {3 s2 g; x% X9 T$ K
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
$ [- n: _! E- v8 K3 `6 V6 Vcross_marquee.style.left=marqueewidth+8
# x1 w# i \/ N* ycross_marquee.innerHTML=marqueecontent
5 m: G: M5 _, V. n3 Dactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
# ~. ?% U1 K1 M! m1 `}
2 W( g5 n! F3 E' T) Y; Y( welse if (document.layers){
$ l: _7 x1 U5 Y1 m1 Y8 r- u1 h! Z- {ns_marquee=document.ns_marquee.document.ns_marquee2
* ^# ~5 H/ l3 J' M4 l" w6 K& gns_marquee.left=marqueewidth+8
) D* j5 i7 D% L+ Rns_marquee.document.write(marqueecontent)
& J8 D; I* ?' s- c; L& Q5 ~6 bns_marquee.document.close()/ W7 ~# r; Z' p; P5 t3 X8 X# u
actualwidth=ns_marquee.document.width. t7 u$ J# I' p5 a4 d/ O/ d' T# T
}
9 X! {- @9 D l1 G) slefttime=setInterval("scrollmarquee()",20)
) b/ X+ a/ W: o& u}
' n% \' i' ?) u. h1 K4 kwindow.onload=populate
5 g! I; X& l% r2 M2 D+ Z# x6 Q
G6 n4 J% W2 }$ f2 Lfunction scrollmarquee(){
/ b( N6 ?3 g/ c( F6 L* Iif (iedom){$ ~, a1 F* P2 B4 W
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
1 O* V5 X x* f* ?9 q$ [. scross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
" q& n8 U) e! l( y2 ?- Felse1 q1 ~ @# c5 a: d+ h
cross_marquee.style.left=marqueewidth+8
# V8 f- j# Q* v5 W$ B2 o K1 y* B4 Y8 u
}
- w' S5 R h7 s; W& U6 K/ felse if (document.layers){) r% J# W' O( ]! l9 {, O
if (ns_marquee.left>(actualwidth*(-1)+8))
8 g) l* _/ a3 P- g8 S; nns_marquee.left-=copyspeed' W! a0 V5 K0 L, H6 c8 _5 l
else* e, L @6 w# n- R7 c
ns_marquee.left=marqueewidth+8) k# W2 c% o5 J- n/ E9 r) @0 {0 R; D
}
4 O4 [9 t) L- i( u}
: O- `' W' d# ~4 y; T$ B: B: g, B4 ?6 l1 ` Y9 C
if (iedom||document.layers){
! \3 {; l2 p5 ~; f8 Xwith (document){
8 V6 v4 Y0 P* O9 Qdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>'); K$ N4 n, U3 z' |6 M4 J7 O7 @% ~
if (iedom){
* v0 ]; s( F4 pwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
% K" u$ ], Q2 L8 Twrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
* P7 I8 E) i8 x1 Pwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
( l3 \, g9 Y/ ~% ^* gwrite('</div>')
: p [ S0 A8 i' E p}
5 s" u6 Y4 w1 Z0 Nelse if (document.layers){6 i! _. g( K7 x4 |/ V
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'), H r* O( Q- Z- f% Y; T# I' f' `
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
4 @5 B: G6 c* k( dwrite('</ilayer>')9 T3 U) {- ]. p
}5 Y8 I, N, M% d- _$ n
document.write('</td></table>')
& ~4 {* c7 Q9 ]$ x, p' J}
- X! L9 J" b% I}
2 O( S0 T7 s$ Z$ g</script> |
|