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

|
网页之跑马灯文字特效
//修改宽度( H, k; ]) U& E" c4 K- ~0 U
var marqueewidth=300
3 H; v* k8 t1 t* m @8 B8 `4 B( ^/ T//高度# E/ B) K# Q Y
var marqueeheight=25" p2 U, v3 B, v/ f2 a, V s6 ]
//速度(1-10)
/ W5 s; Y4 b8 c$ l. `var marqueespeed=39 @8 v! D# ~' s, e1 F
//背景颜色
; U& S9 G( X4 p: B, D6 Uvar marqueebgcolor="#FFFFFF"
9 J' b* {: z2 [7 J/ F//是否能暂停 (0=no. 1=yes)?
# F- K/ F; t4 U8 V! Ivar pauseit=1
, H) E0 B. V% d: Q! d# W; F9 q
8 I6 n0 N+ v! l//修改显示内容7 R2 `0 P/ L+ r5 i
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'3 c+ {, p1 J1 f. t1 s
4 b; [% @: S" ~5 f8 k
0 a- A) j% K, b$ j; j////下面不需改变////////////
! [1 ~ z1 I; {: A+ D
- G a& K' V; n4 n- ]+ \9 lvar copyspeed=marqueespeed
% v* S% n3 t! N, Ovar pausespeed=(pauseit==0)? copyspeed: 0) }! [: {: c6 l5 j+ n. N/ T2 \
var iedom=document.all||document.getElementById
2 ]: H6 A3 [% x# ?3 E2 pif (iedom)
3 k5 P S0 v/ g' A! t4 ^document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
7 `1 }# [! ?7 t% Z8 B7 B- ^. ^var actualwidth=''7 ~: }" K& Y' C, b& _( z: a2 P
var cross_marquee, ns_marquee
! v5 a7 e7 K, t' O$ T/ \
5 a' E5 A: T8 N: G3 G! N4 Ffunction populate(){
0 S$ s$ G: {7 ^( Nif (iedom){
. f9 l2 ?& \7 |0 r4 ]0 U9 F/ Tcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee% \( {* {: u% F7 Q
cross_marquee.style.left=marqueewidth+80 \. Q/ z) H0 p1 j# T# F
cross_marquee.innerHTML=marqueecontent
. {6 w% a: E- V% O6 s" R7 Q& H1 ]actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth( z9 u. B3 S4 }4 G7 W8 n6 t
}
0 P0 m+ @, H1 w2 [# C& P aelse if (document.layers){# t" E% y5 @! x
ns_marquee=document.ns_marquee.document.ns_marquee2# T+ G0 O8 s2 @0 ]7 U1 s1 z! [
ns_marquee.left=marqueewidth+8% f( D& x5 A* j/ R8 `* m3 t$ c
ns_marquee.document.write(marqueecontent)
( f7 L9 K! q6 D& l2 ens_marquee.document.close()* | Q8 h0 z/ E5 n/ j
actualwidth=ns_marquee.document.width
! f3 U/ X; I) [/ O1 ]$ n, e; a4 B}
) S. ?! p5 v) A* O2 Dlefttime=setInterval("scrollmarquee()",20)
Z" u1 P( k: x! U9 v}
; i* K, l9 C2 }5 }2 wwindow.onload=populate6 t* y- i) P' h
- v5 C" I9 \0 W3 k4 h* ?function scrollmarquee(){& b4 I% a6 m7 ~+ e
if (iedom){- _1 t: D9 }! n* W: ?/ Q
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
9 |) x9 o9 u: C& y$ x6 Hcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed& |9 @, P! \! L$ R
else
1 \3 b6 b- l1 f5 d$ D# Q( {cross_marquee.style.left=marqueewidth+8
( g1 c1 _: B$ M; |9 l
) o4 E5 F1 E' a9 {}
% d/ v7 P' p' K0 y6 Z2 pelse if (document.layers){% |7 c! r" t3 H
if (ns_marquee.left>(actualwidth*(-1)+8))5 k5 ]- d( \' h7 I
ns_marquee.left-=copyspeed
/ v* E; w4 F2 }4 [. Z! k: a$ delse
( k0 r) ?- o3 E% t$ m, M7 Wns_marquee.left=marqueewidth+8
/ {8 }* t- A a7 |, y- {}
1 V2 [( \) \" o/ ^# L% M}; d% H$ j7 x5 |
# ~% p. o% f) g- G5 }! Q; |) F
if (iedom||document.layers){1 k2 S. x2 }: J, B
with (document){
* m+ D$ V# t i9 j- Y- D! idocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')/ a0 p# ~$ }: S! ?1 Y( p7 P
if (iedom){# a1 i: @0 `; _
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
+ C5 L4 K' L% j. u9 `write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')( U, Q: Z& p6 k8 [
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')" k* a% g! B- }% d0 |) m3 y6 P8 P
write('</div>')
/ ]- [/ `3 i. M/ J}3 o' `/ E6 e% n. ?8 A. \4 T
else if (document.layers){
( L! g; ] A( x" _$ zwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')5 V4 S4 Z5 c8 [
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')' d3 \4 m5 H1 B) x' e4 U1 o
write('</ilayer>')1 H9 c- b9 y3 {4 S2 A0 w4 o$ W5 ]
}
- ^) |7 b- d* W5 H0 `document.write('</td></table>')# P \! d8 J% K0 [+ n
}
, }4 d2 r- f5 z* `6 s}7 N4 q0 S; `% k3 \% E
</script> |
|