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

|
网页之跑马灯文字特效
//修改宽度
, s5 u9 U6 l4 p: e2 d. J1 qvar marqueewidth=3007 v3 @) I+ h; ^$ R5 j! K
//高度7 c' F/ o" n) C: F- E
var marqueeheight=25
$ c4 h. w) l& e" c6 d//速度(1-10)
% @0 r* b$ a" T9 k2 k6 ?) Qvar marqueespeed=37 e* Q6 R3 \, r" M2 r# c! F
//背景颜色
& b: e0 m# d$ s6 yvar marqueebgcolor="#FFFFFF"; g- ^, p; m4 S( T& P$ m4 G* V5 t7 i
//是否能暂停 (0=no. 1=yes)?
. [" G$ K- I$ f5 f# Vvar pauseit=11 \$ w) A" }+ I3 l8 [; W f4 T- ?8 f8 X
% c5 X2 H3 k- x' X& ^$ i
//修改显示内容( u1 z$ E* Z( A6 X
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
; t ?; G1 `! L2 s* q/ B
2 R$ I' e! y* v3 {
9 j$ N0 | O$ T# T. l2 a////下面不需改变////////////
3 p! s& }6 Y4 i% P* }$ k, o c
var copyspeed=marqueespeed- Z/ `5 U. e5 U" P9 A1 d5 u9 P
var pausespeed=(pauseit==0)? copyspeed: 0
/ U+ ]3 q: x# o# u4 `& Wvar iedom=document.all||document.getElementById( u$ K- |/ k6 M1 d1 e) H W6 C
if (iedom)
& | L8 |. f- f+ D& D, Pdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
/ R1 m" d2 i$ {& X( H1 svar actualwidth=''
% C& b! C8 u' E2 yvar cross_marquee, ns_marquee' {! t/ e5 P/ |, p% P8 M
- f$ X- z! J( i/ q+ q4 x7 w, U6 ifunction populate(){8 |2 ?4 \6 a7 e- Z
if (iedom){% g/ z0 q* }0 {3 {5 F
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
# s" r) H( h1 T# Y% s) J& t% ]cross_marquee.style.left=marqueewidth+8% J- m1 u3 K- d5 x0 A. z" J: `
cross_marquee.innerHTML=marqueecontent. l" W1 j6 d! W3 [1 t5 @+ A5 |
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth; c* m. G3 \$ R( p
}1 F* r$ ?* ?6 }* [& H& `$ B) C; ^
else if (document.layers){
) ~+ D. d3 _& Vns_marquee=document.ns_marquee.document.ns_marquee24 @/ }; b+ ]1 D* `! t1 ~6 \" U# t, I
ns_marquee.left=marqueewidth+8
1 M8 a/ a: S4 E3 R$ {ns_marquee.document.write(marqueecontent)
0 K' f/ |4 w6 w( v3 tns_marquee.document.close()- w; B, N s* x0 c
actualwidth=ns_marquee.document.width
& o! |5 _% w6 m, _) W/ T# E( X& g}
# T ?& K2 |5 c" ?5 `7 b+ W- ~lefttime=setInterval("scrollmarquee()",20)
# ~. d; m7 H t, E; h}
0 x9 R; e y) S' C3 zwindow.onload=populate- Y4 i9 f1 o, t a% I
) F: U( N3 G" A4 X; d, G7 f
function scrollmarquee(){
; [; b6 ^' V1 [. W4 J! }4 Iif (iedom){ o9 ^9 @" g5 E7 R) G
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
* Y# E* e, u* h) |* i& kcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
* v+ H) T) v2 s. f/ jelse* ~) x5 o/ W/ l( Q8 s G
cross_marquee.style.left=marqueewidth+8
! a: `* f4 Y: ?9 [- m! U8 u& V6 [
% Y) J! \8 i3 Z, M7 @) @}
+ L* y2 ]& F1 X6 j7 A( Z9 m! Uelse if (document.layers){
* L Z( l: y5 l9 l( Fif (ns_marquee.left>(actualwidth*(-1)+8))& S& h: L! T2 T0 d& j; c
ns_marquee.left-=copyspeed+ `4 s0 c" Z4 O
else6 g% v# g6 A. o. h6 Y" Z8 S) M
ns_marquee.left=marqueewidth+8& \ d# a( M3 K" c" i" \
}0 i% @( y+ |/ N6 s
}# }# T0 V. e+ r( \
: L3 @; L4 F/ P1 G( U
if (iedom||document.layers){
! q8 \- ]: I9 E5 zwith (document){
4 r2 r* a! E' e/ Y1 D! ?document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')! f( @9 w4 }' W6 r5 d `; a) J* S
if (iedom){
; a3 ~% \( y( U& [1 Pwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')5 a" u! ]% d/ o& `5 N6 {
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
5 z" }2 F6 W0 K0 Xwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')1 J/ U1 s! K, n* Q) }, O z
write('</div>')
- d0 ?$ v$ k' e6 G" o6 N( b$ b}
3 Q$ o% ~& K1 [/ ?) pelse if (document.layers){2 t6 I4 B3 C `4 j1 s5 p
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
- K4 G4 [2 g, X" Uwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')1 |4 m [! w9 m1 ?$ U; S
write('</ilayer>')
% {$ h. x( u7 O( b) \/ u. K}$ Y3 k: k+ e+ k0 R+ l# O8 r O& X
document.write('</td></table>')0 b( {* s6 k' u4 L# H" q
}/ `8 ]* ~. ^! j4 j- v& D
}
+ u0 Z6 X; [: H4 ?$ ^. ~</script> |
|