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

|
网页之跑马灯文字特效
//修改宽度" J3 z; [' L& @
var marqueewidth=300
- Z# b, p3 y$ r2 Q4 `# V3 `( g+ V//高度
4 m# Q+ Y/ j5 R& [( O9 `var marqueeheight=25
; ~8 r# f/ `! `; A0 v1 q//速度(1-10)
2 K8 U# I" i- h$ D# O |2 R0 Kvar marqueespeed=3
5 \9 I! c$ X o3 }$ L" ?//背景颜色+ ^( F( V( W; g+ U9 j
var marqueebgcolor="#FFFFFF"2 f& {: Z0 f0 i1 M4 T) `
//是否能暂停 (0=no. 1=yes)?% o" b; l4 H' ]
var pauseit=1+ N2 \8 r* f6 J' J* f/ B
$ P S1 T1 |; V! H' ^
//修改显示内容* ?+ N# J& [2 |8 v9 d2 O0 W
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
+ A$ x$ k% | ^+ P
# W0 e: {8 l8 Z- P
* c! F( h* N. U! q0 |6 Y9 U////下面不需改变////////////- v+ ]1 h" R6 P; j, {
: m* Z8 `7 H1 k3 g+ c6 @" Qvar copyspeed=marqueespeed
2 z# j- `$ v! Avar pausespeed=(pauseit==0)? copyspeed: 0
, x: c! q$ I6 }. a0 C( R9 W: Q% ~var iedom=document.all||document.getElementById
6 Y( J0 D9 K) }9 s1 Z; rif (iedom)
* P8 Q5 L( A; H9 p$ L6 g/ R2 \0 R: ^. Ndocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')0 F0 u; v) W% a+ }( I
var actualwidth=''
s( F7 i) G6 wvar cross_marquee, ns_marquee7 a" l% p( ?( e& R ]
* ~9 S- S; e; Y7 b% R$ Ifunction populate(){
% M, U* D; V) Y# U0 Vif (iedom){
- B: E( g& K$ V% ^, ~. gcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee( y. K/ E: S9 b. f
cross_marquee.style.left=marqueewidth+8
' j4 |) c3 R+ s0 M3 d. kcross_marquee.innerHTML=marqueecontent
- g1 p3 z3 J& _3 nactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
- C* M* c+ J" W! N8 C}
! R6 d8 B9 C6 T* T. L' Qelse if (document.layers){9 P" {7 M/ Z3 Z c
ns_marquee=document.ns_marquee.document.ns_marquee2
* x( @' o+ I7 M* X3 i8 Rns_marquee.left=marqueewidth+8
2 F! y4 A; \* T3 Vns_marquee.document.write(marqueecontent)
* u0 V5 [+ ]: Uns_marquee.document.close()
& B* Y7 Y0 `, Y5 s0 ~5 s% Sactualwidth=ns_marquee.document.width* e3 u+ e. P! j. B6 q
}3 W7 r- C2 i. r. x) s5 Q+ H* |
lefttime=setInterval("scrollmarquee()",20)0 J- Q* ?2 O& A+ K
}0 y, s2 d/ a' a/ a" s( d
window.onload=populate5 k) P) _$ U3 R5 j' j$ T2 C
; {6 _" s/ \. J& [2 a5 n0 X8 d" Ofunction scrollmarquee(){
0 b0 v/ t( L* L) N) u: `! J; sif (iedom){
' B I' S/ K' C- f/ I9 r! Q. rif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))+ l, s7 ^9 I7 K @" \
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed/ ~7 s0 R: }% l G6 n; R2 S
else+ z( C6 q" d4 y3 X8 F% C! l* t Z
cross_marquee.style.left=marqueewidth+8
' B- Q- R# W( X- P. R) n4 A+ U
1 Q% X% F8 Y m/ L! O# R8 w# M& R: `' v}
. C5 [9 o0 }. c' Y1 {. }else if (document.layers){
- |: n1 d5 t4 r* s8 q& qif (ns_marquee.left>(actualwidth*(-1)+8)); F% b3 K W2 }3 s3 ~
ns_marquee.left-=copyspeed) q" o# G6 C3 V* N5 a; x+ v
else7 M: }4 O6 [9 j! T0 h' @/ Y
ns_marquee.left=marqueewidth+8" s, {9 v% Z/ x5 I# ]" t
}
) P% j, p* @+ U+ ?/ y: H# w1 v}" R1 I B* u2 z5 t* O
! H7 U; h4 r) _. s: u/ N6 k C" cif (iedom||document.layers){; ~2 B9 q o4 S: @6 |9 G; K
with (document){% C7 f2 R6 Z/ r; x$ P' M1 G4 V e
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')0 x7 p. D8 ~" n5 q9 L! m. C
if (iedom){8 w+ I( U: L2 ]0 I {
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
) E5 B& }5 v" c+ w+ @write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')1 j; j; w; C8 e1 y1 l
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
2 p" C2 V. ?3 }" r; t* q$ K! k" s9 Kwrite('</div>')8 ]% D. d( J h1 N2 C9 _
}
" M) U" I2 K& K) f# C( u3 x1 ielse if (document.layers){0 b- x; [; q! n$ Y8 C4 ]
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')" `# Z9 I/ |5 _% Y3 r8 {5 y
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')- e+ O! f0 D5 Y! A' r
write('</ilayer>')2 R5 @0 }- x, X8 ^6 n( z
}% j9 g, E0 E! `* b% x
document.write('</td></table>')& Y c# b, `, _1 A6 t, b
}8 m- k+ H& n! ~, e7 R; L
}6 ^( P$ A1 ?- F7 P
</script> |
|