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

|
网页之跑马灯文字特效
//修改宽度% q( ?+ \. P! l8 @* r* K6 d' v
var marqueewidth=3004 N h# ]) P, X! s5 z) N$ Q# F
//高度2 h, b5 J8 Y* K# s
var marqueeheight=25
9 _& G6 c5 ~( A, c6 n" c6 b Z+ @//速度(1-10)
& v' x! W5 m' B% n3 cvar marqueespeed=3
+ t. O$ }$ H+ w! p' b% p//背景颜色
3 Q; H2 A. A! [5 W" T- h @' }1 u- Avar marqueebgcolor="#FFFFFF"
6 Z7 ]( |* v. _# q1 b* i6 r//是否能暂停 (0=no. 1=yes)?; F! K1 t/ @3 A7 J) i& v) d! Z% q
var pauseit=1
+ e2 X6 o7 e6 A8 h7 q
" X- s5 y0 y* u. i//修改显示内容/ D" S2 W3 f/ v* B" l
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'3 n6 v, h; j( H0 u2 \
* m0 S" B1 H/ E! O6 w7 _2 h( {% m" F
////下面不需改变//////////// t% D$ F$ b4 x( Z& g
* q! h/ c0 r) S9 i5 U; Z, H9 n$ C0 @
var copyspeed=marqueespeed
) e* ~- X/ J5 F. A7 ~var pausespeed=(pauseit==0)? copyspeed: 0
) f( ]4 d( R( T) U# B+ x; Tvar iedom=document.all||document.getElementById5 r: b. K: t7 N M' e9 G
if (iedom)/ k( O3 J# w, E( z1 \
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
) v' c" K5 Y# b5 K5 ]/ \+ B5 qvar actualwidth=''& [* F/ j5 [* p/ Z
var cross_marquee, ns_marquee$ R' U0 a5 S: m& k: I2 y
6 D8 b8 R1 c$ R: z: ~
function populate(){6 W5 l. @5 S( W+ ~: s9 L
if (iedom){
) X% P8 z$ d0 I% ]cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee4 d& D4 O" [# i2 S: M+ \
cross_marquee.style.left=marqueewidth+8' X1 Q2 m( |* Z K" m$ {1 g9 B
cross_marquee.innerHTML=marqueecontent6 a/ f, d( G& e
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth) M- v# r! p$ Q
}
4 O3 w! T! S/ m1 \7 ^! C# Kelse if (document.layers){& B; h4 } ^/ ^% y' P' H5 \
ns_marquee=document.ns_marquee.document.ns_marquee2
7 F* a7 q9 `: Sns_marquee.left=marqueewidth+88 `% i& L* x b. U- q- D+ V$ S4 c/ z+ S
ns_marquee.document.write(marqueecontent)5 l" }1 [, g- e. J- y; t9 C
ns_marquee.document.close()& }* I4 t4 l: a" U+ T% N' R
actualwidth=ns_marquee.document.width ]* A( w) {) d+ [+ t, M5 U5 ~
}
: g/ X8 y& d/ y/ |( X% Alefttime=setInterval("scrollmarquee()",20)6 B3 m: z7 p" ~# o/ g3 I. k- ~8 m( v: M
}0 h! Y) l8 \) ^4 K! l# ~* R7 h/ e
window.onload=populate2 C2 @5 w9 \1 @ F) N% h
, j/ T% m( D0 Y: Q$ p
function scrollmarquee(){
6 L0 R: A3 I7 Y1 Rif (iedom){+ \2 m3 r6 [2 @( Q
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
& T$ _4 z- ? I9 O& ^cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
* u! k5 `8 k1 A9 w" u8 Qelse, }/ V( D$ N7 I5 v
cross_marquee.style.left=marqueewidth+8
; ^; [# A/ W2 ^' |2 J. U8 E7 T; K( i/ w7 J2 @
}7 }- r1 [8 X& I; m& j8 `
else if (document.layers){2 G$ ~0 V* W1 G4 ]; W% @
if (ns_marquee.left>(actualwidth*(-1)+8))
7 i! G- s2 H$ Q4 D( I D3 hns_marquee.left-=copyspeed
& e1 D3 Z0 C% P0 H+ e; x5 melse/ s: s5 F. `1 R# c, `8 S
ns_marquee.left=marqueewidth+8) F U6 e% q7 i6 n# K. a
}8 c! R, J5 V- A' `: _% H
}1 p# g: Z2 ^9 G; `2 A
& O) ~0 v& o+ P& j: ]6 B0 |4 N9 w
if (iedom||document.layers){
! p: n% p& X3 Cwith (document){! c! H$ ~6 _0 g' j5 [8 P
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')& D0 Y3 r3 n; J
if (iedom){7 L5 d' o( T5 |+ q+ {$ h/ z
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')! {( f3 Q( ~# p1 H
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
6 z. ^. P9 @8 L1 [" [write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')6 s) {7 f: C4 v) S! p! E, t
write('</div>')
V4 ]! l& G/ p5 |5 V( s}
2 }% J& T; B0 Q7 c6 K0 ]else if (document.layers){
% o7 D( H/ f# Y" ?write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')3 L4 v3 v$ Z- @4 T' x' J+ E. F
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
5 e2 X' y4 d7 Uwrite('</ilayer>')
; e6 g5 k8 `, @}/ T4 o: s7 @) }" C f- h. Z8 l
document.write('</td></table>')
7 u/ l& c- F# i: u& \}
5 |) V; D" ]7 a1 L: B}* ?) P% I" w. X. C0 ]2 R, X& J/ S
</script> |
|