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

|
网页之跑马灯文字特效
//修改宽度& l9 o( a/ ]8 L' n) m# ?- ~& H8 I# w
var marqueewidth=300
+ H3 N& F! j. j//高度) R2 f& H& j/ O/ M( T3 F C$ X
var marqueeheight=25
7 t9 G: x: W0 P/ ^0 o: O7 K$ i, B5 j//速度(1-10)
, m0 W, ?' A0 V. d! Bvar marqueespeed=3- D# i; \! f( w: d+ I* ~
//背景颜色
* M3 x _) O+ i& Q1 mvar marqueebgcolor="#FFFFFF"
) ^' |; x6 N2 f+ f& n* |//是否能暂停 (0=no. 1=yes)?- Q* f. R. f: U
var pauseit=1
8 p; i$ f7 Q3 g( p8 v/ B& W p$ }7 G" m( h" N/ L
//修改显示内容* N- J2 c* p2 A1 n8 a0 B# q" _
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
* [$ a. `; ~: H- \0 \" _% A+ x$ u" R% W
8 l7 m( X4 A/ `: p
////下面不需改变////////////
5 l, X) G) {, ~" _0 x# j" @; F f. b6 _; T: i! g
var copyspeed=marqueespeed; t% ]% D. g8 q) E! g: i+ P
var pausespeed=(pauseit==0)? copyspeed: 0: l) q& [/ @$ b5 `
var iedom=document.all||document.getElementById
( V4 f, r: F- _3 R) a- i/ uif (iedom)
5 ~3 p3 o/ O; ?1 Q: S% J- Z* Rdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
' e4 y$ {( ]0 ^var actualwidth=''
5 ?5 B( j# p `" E2 Vvar cross_marquee, ns_marquee
4 r% H2 s; b6 ~- A0 M3 n+ o/ M' g' U
3 @7 d/ | |, Zfunction populate(){4 x9 r9 z: }/ y$ n! ]# l r% A
if (iedom){. ]0 F3 z5 n7 ~, P# p) O. i: Q
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
5 j5 B6 X$ @' W5 [6 l4 R, Z2 b9 lcross_marquee.style.left=marqueewidth+8
+ o( }& x/ }. ~* l' }; d& xcross_marquee.innerHTML=marqueecontent9 ~5 d. d6 Y$ ^! X3 B, p! U
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth( i/ l( v7 q( r/ m& w1 O* w4 V
}) _ s% C% t4 Q% A/ [9 l
else if (document.layers){
" s! `9 J2 k7 v) l1 Cns_marquee=document.ns_marquee.document.ns_marquee2
4 n& G6 Q0 r5 ]9 sns_marquee.left=marqueewidth+80 r- j+ A4 b! h7 C
ns_marquee.document.write(marqueecontent)& A3 o7 C5 I8 k0 m: I* l4 y, h
ns_marquee.document.close()# ~4 t# X3 b+ t9 }- j% T4 j9 C8 [6 ~
actualwidth=ns_marquee.document.width6 e4 o/ H# W( X( S' d0 W' f% W
}4 J @ v& H5 C' G' v$ D: v
lefttime=setInterval("scrollmarquee()",20)
) V+ K! A$ p4 K4 Z' i8 h}, X8 u) `+ x4 z* P
window.onload=populate4 A& z _; m3 O' q& m
5 A) ^' v, k$ u" I
function scrollmarquee(){8 O5 O) h% o' ^
if (iedom){
/ k8 J' ^2 g( z `( R- y: jif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
& E; L: G- V( Qcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed# k* c* i; m; W
else
+ {: q" [6 O8 }- f* N6 n2 rcross_marquee.style.left=marqueewidth+8! T- f" j- H( P1 g
+ x- _; M0 C& j& t$ R}$ h% t9 I* v% i) W& o& ?& r' o3 i
else if (document.layers){4 z, I& X8 S6 j' `5 Y$ u
if (ns_marquee.left>(actualwidth*(-1)+8))& H2 Y4 q; V# ^8 R- S
ns_marquee.left-=copyspeed
3 Z' p% l5 r0 z! o% H9 b- }else
$ R6 s% b! _" r! v8 h. Yns_marquee.left=marqueewidth+8
% P# Q% M7 Q( F}: Y8 M9 q5 R" h# U
} n5 S' Q& T7 p5 c0 o
$ ~& L6 l, X* R) U' S1 o/ {& c
if (iedom||document.layers){6 [2 n' a! G, I6 o: l3 a
with (document){
" d0 T8 T5 @! l: X7 jdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>'): z/ [' ^3 }- r3 S2 Y+ p9 ~! A- g$ U
if (iedom){
& p+ T/ }9 q( T+ u8 r& A' cwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
4 M+ R2 C& Y+ M2 Q. }8 ?; p. wwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'), U* w& `8 o$ q# j2 d* ~# N
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')( F8 z4 H# o1 \4 L3 U! H" {' H
write('</div>')$ j1 z0 X6 q' s
}
4 m3 v( Y& C. x4 K% Z4 f% Helse if (document.layers){4 \# A, K2 ^8 [4 I9 j
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')! j" B: X6 }4 Y5 t5 w4 `9 s0 P
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')+ C0 p1 W# p* a: P# Y0 }/ Q
write('</ilayer>')
# {+ `; }1 F5 [}
' i" y0 f: ?* }6 z# idocument.write('</td></table>')6 ~, t* T$ N% }9 s$ m
}
8 i8 Q5 h N- h |" S}
1 ]% S6 P, L* \1 ` L# r3 D</script> |
|