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

|
网页之跑马灯文字特效
//修改宽度
; R1 p3 w) B+ J" V0 s: evar marqueewidth=300
# R+ r" G, J# A1 b! Y' I//高度. \9 I% v1 D; P( V: N1 j
var marqueeheight=25
: B7 u9 F% {- \, h G//速度(1-10)1 ?1 G7 y! l4 d
var marqueespeed=37 H& f/ S- y/ m
//背景颜色) P1 T! J4 o1 S% g3 L. B
var marqueebgcolor="#FFFFFF"
$ _0 h) f) M0 C3 Y- i: P" E2 w//是否能暂停 (0=no. 1=yes)?
$ }; C. b' Z5 @! I5 Evar pauseit=14 r5 u% J! y7 [9 h+ @& \
$ n: S4 l6 Q2 p- l
//修改显示内容
' E4 _3 q9 R( F3 tvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
$ d" R6 M& u3 b; q6 z$ `+ x5 d
3 h" M7 c5 h# [% y2 O# e: z# }" o0 R1 x8 z y: p
////下面不需改变////////////% m: N1 \; H7 T( q1 o( l
2 x. `8 q, D) B& n/ t/ E
var copyspeed=marqueespeed
7 S ^ R, d2 Tvar pausespeed=(pauseit==0)? copyspeed: 0
2 @9 m6 `' z& z2 H8 u5 Mvar iedom=document.all||document.getElementById
% [' N" z+ y3 Nif (iedom)- ?6 G/ z5 e$ g3 t
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
: B1 S- ~0 F$ D9 T0 I8 w. t5 N/ Kvar actualwidth=''
1 ]" q+ p; b' Kvar cross_marquee, ns_marquee
- z5 n4 A2 m' E& V0 ]0 ~* l* { \( _0 M; n
function populate(){
3 Q' G3 @" x, C- R( W9 K( f3 A0 T, C- vif (iedom){$ ^0 ~% L# L& Q" H0 i
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee! Y9 D' y8 Q3 ^7 |4 P
cross_marquee.style.left=marqueewidth+8
+ x% e5 g7 H/ A4 Ycross_marquee.innerHTML=marqueecontent/ D% [8 C" l. O6 S. @: F
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth |. M8 c/ O6 j% Q Q4 Z( G1 T
}7 N% u$ r6 ^ N4 W! A
else if (document.layers){
4 ~+ c7 Y8 Q. }- Ins_marquee=document.ns_marquee.document.ns_marquee2
2 q) v* H# c% Y3 l" Y, G" Pns_marquee.left=marqueewidth+8
* @* _9 N3 S4 P2 M% C8 {) [ns_marquee.document.write(marqueecontent)( |3 s6 l# F/ h& D+ n1 D/ F, g( C
ns_marquee.document.close()
* E3 V: H- \' {, j0 tactualwidth=ns_marquee.document.width6 T1 q# Z; ]: K$ d' V
}( ]/ A4 ^# {- s" Q5 b8 H k% Y
lefttime=setInterval("scrollmarquee()",20)0 o: Q4 S+ F- K
}1 t% e( M4 t1 Z& Z* S- B* D1 a
window.onload=populate
( G5 [: w, W' W5 _
u$ d1 R- C; a+ C$ J1 Zfunction scrollmarquee(){
2 C3 h( x. P7 R8 R$ K( cif (iedom){
$ p* y, C/ W+ v8 ^- Q8 Z, eif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
- k' Z* z. v" y8 {, n- x; B5 [cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed5 R5 k8 S2 R( |! }- d
else
& Z$ j5 Y! e* ]0 W% n. Wcross_marquee.style.left=marqueewidth+8
( O$ Z8 j8 f, {8 \3 p* ^8 N" X8 S
}4 ?" s( R1 k* g7 |- S [+ s% j
else if (document.layers){
0 X+ [, ]: n: I) v0 r- pif (ns_marquee.left>(actualwidth*(-1)+8))( M0 x# e$ P2 t- H( j8 F0 G' ]
ns_marquee.left-=copyspeed
: i: ?4 T9 f5 g* b# {* S; Delse0 c6 \& E4 m% [+ V; b5 _# i
ns_marquee.left=marqueewidth+8
$ k8 h& ^* U" ]/ I0 y$ s, i}
; ]. Q& e% P D) m4 R8 e9 b}, F9 ?+ L1 b) C! ~- V- l
- M+ S! R3 X* [5 Vif (iedom||document.layers){
/ ?; z, U3 o( C/ X( D1 awith (document){
, _; x% T$ q* `; m. `document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
" _ U; l) M# \: [9 s9 f6 mif (iedom){
% ]5 f* j- A+ u6 hwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'), z3 U; R& R2 [& j
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')( u: _8 z* z" s& s Q
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
/ |' p2 L3 p0 g$ R. mwrite('</div>')
/ v; y9 b" M/ V/ R! S}8 L2 @- E- x% U$ M% {5 f
else if (document.layers){
' \: W8 }8 k } ]8 ywrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
0 F% s3 e- J' Q( m7 @1 l0 rwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
% N$ H2 t. m. p; c2 I- Uwrite('</ilayer>')
9 ~- ]! W" ]9 s$ j' |}: ~; y S7 i5 r# E5 p; S. S4 K F
document.write('</td></table>')
: z+ g2 }* L& L7 x& [. n, S. f! [0 _}- o& Y9 l' Q4 t. J+ ~
}: Y+ J( I7 i* x
</script> |
|