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

|
网页之跑马灯文字特效
//修改宽度9 R! Y" I M" B6 b- s; r3 ~
var marqueewidth=3009 e, X' t [6 n! x; ]7 R3 u
//高度# h4 a7 s0 x& O
var marqueeheight=25
* W. p+ G9 v) L//速度(1-10)
2 t. s7 }5 k2 Y5 |' j- ?var marqueespeed=3
3 U( n6 Z! c6 P! V; t3 v//背景颜色
. }3 ^! C ~& ^- \& Ovar marqueebgcolor="#FFFFFF"; g w1 T/ |+ x) [4 G
//是否能暂停 (0=no. 1=yes)?# Y% o3 ~/ ]' X2 L5 g( t
var pauseit=1
( e% H' K6 N2 H4 m: k( j, @8 N
% h) l' ?2 A* T/ e% w J4 T//修改显示内容5 ]: C0 z' K) n, _$ l
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
% p4 [8 e: P2 @% W; N
, F) t3 a0 H' H: b
$ Z& C, }2 p0 k3 U, p% [////下面不需改变////////////
* _4 O" n# o& \+ O" i5 i
# p# @* l1 b1 H' D/ Dvar copyspeed=marqueespeed3 f- O$ s9 w W- b# x5 [
var pausespeed=(pauseit==0)? copyspeed: 0; L$ K8 G5 V$ j$ v0 \/ J8 E z
var iedom=document.all||document.getElementById
, j& J+ d8 b. O7 a1 Z6 M4 g3 Eif (iedom)
2 x+ e) ^0 r! W7 hdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')/ e& }& o6 p& w& N' z7 w" Z
var actualwidth=''0 D, f* m j5 K
var cross_marquee, ns_marquee5 V0 I4 l p" k
. X6 X' V: v" n7 o. Y
function populate(){
; Q$ T$ w( e0 b& _4 q- B5 E5 rif (iedom){
% h+ t& v8 j9 s' x U% Q. kcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee1 P4 m$ O7 y/ \0 {# a, J
cross_marquee.style.left=marqueewidth+8
6 e+ O$ v- Y0 }1 `cross_marquee.innerHTML=marqueecontent
; J" _, v+ Z, s1 {0 m1 Kactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth: w7 o$ v; ] g# m3 q3 w. \/ g
}' n! v# c! o* T9 F7 `- \
else if (document.layers){; E& Y. |# a/ f% t9 c' s; C- R& D
ns_marquee=document.ns_marquee.document.ns_marquee2
- T. P, f9 S# s8 _ {5 X% ens_marquee.left=marqueewidth+8
* a" s) h% s5 ~5 Ons_marquee.document.write(marqueecontent)/ I' q5 f5 S, a
ns_marquee.document.close()
& H! V v N' m I8 _- `- F3 `actualwidth=ns_marquee.document.width
* M. y0 s/ b& P& p! D}
7 Y( k6 }' Z0 l/ \lefttime=setInterval("scrollmarquee()",20)
1 S7 {9 b' f1 A/ x* G1 N' ^. w}% b, Z: q, P A+ s
window.onload=populate5 `7 @& @5 `, v% W4 \6 k
; S, I8 ^8 W" w/ A- A
function scrollmarquee(){
2 ?! a) m: C2 B8 X M' s8 ?if (iedom){
- C* m, w! |9 R5 ]$ u, K/ d c. t/ H- lif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)). Y) O# k) t: P1 @7 z
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed& [8 n/ Y* S [6 K
else
9 W3 I( s5 W9 f. E" Tcross_marquee.style.left=marqueewidth+80 }- P P; }- \: p, l+ t# u3 P
8 C* O- V% a, S}
( m( P: l8 K0 o3 r% a( u# V5 ^' Ielse if (document.layers){
+ g& c0 ]" p; u s0 nif (ns_marquee.left>(actualwidth*(-1)+8))2 Q4 e% g3 V+ r' \7 T5 H: A5 T
ns_marquee.left-=copyspeed
& Y8 T( j8 Y! a) w% r$ h* Oelse
& g1 U2 }" e0 K5 c+ z0 K! yns_marquee.left=marqueewidth+8
8 j: o: x# L# Y0 Z7 a2 K6 r, B}
9 `: [5 `: r; x9 [3 P P+ m}! `4 C9 _ |& M3 j
; [# ~0 U" }3 a& ^+ K9 Qif (iedom||document.layers){7 \+ x3 x9 \6 ~3 w
with (document){! r; F' G7 A) [1 O, j L- J
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
; k4 P4 I; x( W$ c4 X9 xif (iedom){
& T5 f/ H- f9 R: r# O0 Swrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')2 Q5 b5 c, `/ w4 [& Z
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
! G1 @ W8 p9 h/ h9 xwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')# [ u4 ~0 `8 m" B5 x8 o
write('</div>')
# P6 t7 q3 q: p+ y- I}
. m$ T( @8 @, y. U( }+ ielse if (document.layers){
7 R/ G' d3 S; Q) ^# F& P: jwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
+ \, h. w: K1 Qwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')0 O+ h: ~3 b1 R% f K. ]
write('</ilayer>')
6 K7 N% f0 {5 w# k- v# m5 Y y}
; b/ W( @( T- x Sdocument.write('</td></table>')
8 X j8 P2 y9 @5 W3 @0 O4 d _: ?4 Y L+ t}
; ~* a3 { L8 P% i}
! h# F' ^0 Z: y j8 A</script> |
|