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

|
网页之跑马灯文字特效
//修改宽度$ \9 ]6 ?( c) X f- u1 V7 ~
var marqueewidth=300
) I9 R+ g* O/ Z% _( V//高度+ I: m7 c: M! V; C# A0 T0 x
var marqueeheight=250 a' V+ c9 }( W' {
//速度(1-10). W3 Z% R4 R, n% v4 h
var marqueespeed=3
# S2 w9 F. r0 Y5 z# c, k! E8 u//背景颜色1 N$ a9 c4 O# r1 n- F+ u4 i& r. s
var marqueebgcolor="#FFFFFF"0 B% u5 I7 r* _$ O% h+ J; b
//是否能暂停 (0=no. 1=yes)?
# o1 |" K0 l- p3 Qvar pauseit=11 R& O3 m+ K0 R- C) W
2 ]: _' X: f& y" {6 h! k8 Y$ A, }//修改显示内容
% W1 G. K$ [7 ]1 U* Pvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
/ ]3 d3 c. B; {0 D1 Z9 G0 O
V7 E/ a' V2 W( d5 U% t: _4 H* T4 j2 v6 Q4 p
////下面不需改变////////////
5 W$ D0 j: } u$ E7 j
5 V) k( u# k9 f# x! yvar copyspeed=marqueespeed' H/ Q" E1 g( L N7 Q
var pausespeed=(pauseit==0)? copyspeed: 0) X, i% `# g: }0 U: ~9 ?% L
var iedom=document.all||document.getElementById
% X$ G1 N' U0 m( i, \0 Jif (iedom)( L0 N' D# Y& J2 q' {
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')9 |( u3 g. k. j9 @& B
var actualwidth=''$ R/ t/ _+ ]9 I' }! R7 i
var cross_marquee, ns_marquee
# q( k) ^- x" L1 X0 {; E5 T& D5 _, B9 Y7 z
function populate(){
5 t7 r$ j: ^7 \+ p. pif (iedom){
' I% F$ q, s9 w4 y( T: W6 k5 W; @cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee+ c, s/ ]% y, [6 i( J# F6 Z
cross_marquee.style.left=marqueewidth+8) r w! U) f9 |2 u6 C; d% A$ J. u
cross_marquee.innerHTML=marqueecontent L" e* J' F4 t4 T( z& ]. D
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth! K9 |5 {+ f/ G. [! H3 c
} B8 V: ~9 |. m+ X) q
else if (document.layers){
b5 w$ o A& x/ xns_marquee=document.ns_marquee.document.ns_marquee2" R- }# ]- @4 ]5 C
ns_marquee.left=marqueewidth+8
0 A" |3 ?. x7 U5 g4 i2 m$ uns_marquee.document.write(marqueecontent)
& B5 Q' \2 }3 S, z; k1 ]% t# Jns_marquee.document.close()
7 z8 @+ o5 R' g4 tactualwidth=ns_marquee.document.width$ [5 M, ~. n0 h' Z
}
: b# f) S, w. x) r) L; @! Clefttime=setInterval("scrollmarquee()",20)
* ? k- b# l* p! g0 h# v0 J2 z}
x: c c4 i/ J+ C) b- D! `window.onload=populate
0 Z# s9 f& y$ M# @8 q+ k. ]* z( g, z4 w
function scrollmarquee(){7 r( o, Y/ J7 G% Z2 Q$ M2 o c
if (iedom){' C. S1 f( Y6 O# Q2 u3 t" T% {6 A$ f1 G
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
& V# O0 G. C% b0 T& X) Scross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed5 q3 q& I, }7 i) Z" M! I, v9 G
else
# M2 D) L3 P; h2 o( ]* tcross_marquee.style.left=marqueewidth+8
( Z" e A0 r" l2 N9 [) @
! x; d: y4 K% T; z4 K}2 z* z7 p- K% ]- E
else if (document.layers){
' R# E0 h& H2 j8 s7 c, w6 N nif (ns_marquee.left>(actualwidth*(-1)+8))% T- E6 Z1 n. r3 ]3 v
ns_marquee.left-=copyspeed
; S7 h% V4 C1 K9 melse7 A$ b4 W. K, W( B6 q
ns_marquee.left=marqueewidth+8
1 ]" c/ R; g8 d7 U1 t}% T; t! ]0 g+ s* H
}( G1 e+ m' L. ~
; @) P* H% P. {8 xif (iedom||document.layers){
2 n( {9 Q4 l1 d! G9 N! E5 @: b: Cwith (document){3 Z8 K; D; Z" }" O4 M1 z/ F
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>'). K" P$ x' i: y& ?/ p
if (iedom){
; X9 y9 {; c2 J- Q/ p% z2 e% ^2 Cwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
6 t0 b( ?9 b7 n4 h( g$ z; ?write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
; R; G, L1 n8 a. Kwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')1 A* ]. V9 b2 n
write('</div>')
9 ~- m2 }# a+ Q0 W}
! M7 D" j* }/ o2 I+ Kelse if (document.layers){
3 Y! Z5 q9 F% ^. }% _write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')9 |) M1 a% D& i' h# T
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
9 ~) f) u; D7 [' i/ w! zwrite('</ilayer>')
5 m7 R5 w. ?3 s+ ]}9 |" a; n0 G1 f9 w" U
document.write('</td></table>')# Y7 U2 c3 C/ A6 b
}/ E& u% n- B) ?8 z* e* J
}
9 w7 _/ B% K. T3 F9 i9 I</script> |
|