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

|
网页之跑马灯文字特效
//修改宽度
O/ k9 y1 x0 c- c9 Yvar marqueewidth=300
; Q+ I6 G' k! a# F1 F//高度4 O* `' K! u: l1 I. V
var marqueeheight=25
* `+ U6 d& J8 T$ U" a* v5 R//速度(1-10) P4 h( s, \& x3 i, ^9 n) [* l
var marqueespeed=3
c5 X8 a1 b( D, x0 n//背景颜色
( k6 H2 n9 h& X4 wvar marqueebgcolor="#FFFFFF"
4 `: W$ C- t# w" U8 v% M8 _$ w//是否能暂停 (0=no. 1=yes)?
; v4 _/ J% ~! L4 \var pauseit=14 `: q( V" b. z. M) a
, I4 V2 d& \! ]% y: W
//修改显示内容* y- t9 P1 Q: P# X
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
w! X; o7 R% G+ Z8 u! U/ v3 D4 y5 g$ z9 M0 |
3 }6 O9 N) Q1 L+ d6 [2 O* R////下面不需改变////////////
4 L2 N$ ~9 T/ V* d" B. G7 o" e0 _' @$ {- U# v: {$ I
var copyspeed=marqueespeed
9 s3 I2 S2 I. V1 r3 f U1 [2 Evar pausespeed=(pauseit==0)? copyspeed: 0# U3 X L b" d. t: r( ^
var iedom=document.all||document.getElementById P6 w, ~/ v8 i+ `) b0 J
if (iedom)7 F, M7 N6 b1 Z& o: q2 e
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
2 g1 @( O* l; u! p6 j0 d: m) S' d0 _var actualwidth='' a8 h! h0 v# }: d1 |0 N
var cross_marquee, ns_marquee
/ s% S) E% _0 ~7 h6 A- G1 j
; Y* U. b% v: u- x+ u9 Vfunction populate(){
8 h' n# K9 i- J* P S( m+ O# V7 pif (iedom){1 o5 I [% ]/ G7 m/ O
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
, e+ q y' v: o/ `& N, Kcross_marquee.style.left=marqueewidth+8
: F C6 }1 q [! bcross_marquee.innerHTML=marqueecontent
3 N: `. y8 \1 x7 F4 Sactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth2 S' r' T& I: l
}
/ e0 v4 A: r+ D+ Felse if (document.layers){7 F! O8 ?2 q! c
ns_marquee=document.ns_marquee.document.ns_marquee2
1 {: O, _1 a" r3 {+ cns_marquee.left=marqueewidth+8& ^& T& z3 ~+ [8 r; Y) P' O8 L5 r! g6 I
ns_marquee.document.write(marqueecontent)2 u |9 Y, b0 x5 k! s+ Q
ns_marquee.document.close()
: F& b' {$ Y1 i" E+ q+ V/ G% |. U5 kactualwidth=ns_marquee.document.width
: U5 B8 g0 u1 V" o8 Y9 C& R}
h& H9 C: t% s& W+ blefttime=setInterval("scrollmarquee()",20)6 Q6 ^& X+ s( |/ {
}. l* E9 v9 i w+ [- d8 P2 L
window.onload=populate- Y, K- g* U+ g5 A
' T" k& B& u% S# V" f
function scrollmarquee(){
+ R2 \9 g5 o c1 j+ J3 t5 xif (iedom){
' _/ g& {4 ]$ M' [) w6 I% o6 Lif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
8 o0 u# s( i8 g8 _1 P$ {cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
$ P ]( V7 [8 ?* _. Xelse! V+ I$ j5 ?0 \; ~% V
cross_marquee.style.left=marqueewidth+8
* T0 D d1 B; |
5 o8 `* m" ]& ~ F}9 O/ r+ d8 i2 U& a/ m$ o
else if (document.layers){
! Q2 W3 K0 F% K4 _3 v* e- W9 e& Mif (ns_marquee.left>(actualwidth*(-1)+8))
7 q/ h" M! @9 y' F; Mns_marquee.left-=copyspeed* m; F! L" f) z* O. \: M
else" v* T7 o5 s: r
ns_marquee.left=marqueewidth+8
$ _+ H% ~& E+ l}) W, {6 c6 R, u; s5 Y8 n m
}
5 v# k( g% u0 [3 h0 L, C# M/ }; p' z R3 C5 U S
if (iedom||document.layers){
# m* D c0 t( g* }with (document){
. c# i, \2 a, z1 J3 |9 Z$ Z% rdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
4 A- `1 x/ K& U; Lif (iedom){) B' h- W! \8 f/ h0 J
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
, }2 Q1 k! {! M/ X6 s2 T- Kwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
# v9 @' n' c9 Q3 G ^9 r E ywrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')0 o y0 O+ {; Z9 B7 n; }* z
write('</div>')
* W+ J# a0 h: L0 ], ?, W ^% F}
* e j+ c" q3 ielse if (document.layers){5 N/ \2 ?: O0 B1 D, p" N
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
F; H( T7 u) O8 t4 T4 R/ Fwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
7 Z! `0 O" N1 Q% S! Cwrite('</ilayer>')
4 W5 h5 {$ t8 l, V5 h& ]}" H3 w Z7 ^& K# J- `
document.write('</td></table>'). R& X3 _& D+ f' m: |( w' `
}
- B8 \" Z" ?. ^. r1 [# j( H4 |( j9 v* \# l}9 y: a# i9 q7 L/ ^
</script> |
|