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

|
网页之跑马灯文字特效
//修改宽度4 C- R ^& j! C, l9 x
var marqueewidth=300 k& k; d6 F3 N" e9 L
//高度6 i7 H) l9 E0 M
var marqueeheight=25
/ Q9 N5 Z7 W6 ?9 R* g7 E2 x//速度(1-10)
_0 m* G7 A. y6 Dvar marqueespeed=3! X9 { H4 x( U8 f* D5 |: [
//背景颜色
& X% q* ~) R( z ?4 Y! p& Cvar marqueebgcolor="#FFFFFF"
; S! M% ^& A( ?% Q! U//是否能暂停 (0=no. 1=yes)?
2 G. K/ J: j9 Nvar pauseit=1* H9 d% w+ ^1 q5 ~6 {) j
: P3 z$ C7 o0 e' t' {% k+ X
//修改显示内容
8 E! ^8 H/ c2 O5 e8 mvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
' ?. B# b# b1 C+ b& F2 d/ ^5 m o# J! t8 J3 }' R
& v0 m' y" U' |* }* r; W6 C& G
////下面不需改变////////////) [8 A% Z7 B: i6 [- y
; H& `5 @" b& q% m; @var copyspeed=marqueespeed
! u' Y/ x. t. S9 O* a8 bvar pausespeed=(pauseit==0)? copyspeed: 0
& q" J6 R4 |; M' Avar iedom=document.all||document.getElementById
+ w ~# `& n. Kif (iedom)
# r# V. ~' D: y( }- ?, bdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'): J( x) d: K2 h& F$ k
var actualwidth='', q* S& j: p# Y2 I* q
var cross_marquee, ns_marquee
2 k. z( \0 K6 w( m- _" I3 \$ u. W
( B& M! l& a6 o- c9 q* `0 L; `7 C5 nfunction populate(){# t1 {& ~; x. @& l& R4 {9 S$ }
if (iedom){
; [, W) S0 P# I, @5 \6 H8 _0 M) @ }cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
7 l9 ~9 v. {- p* ^1 m4 k Icross_marquee.style.left=marqueewidth+8, {+ A) M: R% p4 N D
cross_marquee.innerHTML=marqueecontent. f% L2 A5 b8 C, n, |8 K9 } O9 E+ n
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth* q( w+ v; s9 x7 [6 F" P. X: _- n
}
% Y$ h- c" j. O! }: p& _else if (document.layers){
6 l1 Q/ d- b5 I7 }4 r: Sns_marquee=document.ns_marquee.document.ns_marquee2
/ s3 c' m) V' I" |8 Kns_marquee.left=marqueewidth+8/ \9 k( Q3 E0 U3 j, w
ns_marquee.document.write(marqueecontent)
U5 u: D5 a3 A- u" qns_marquee.document.close()
8 y! d, ^) l# j Hactualwidth=ns_marquee.document.width
" s% ` D; d* [3 i) g}
+ R1 ?, u! w" V% J( Qlefttime=setInterval("scrollmarquee()",20)
' e; o0 C# _) M/ F+ W$ z; p2 S# _* D}" D! H/ X1 K6 d; h% x
window.onload=populate
, H1 w" k5 y/ K4 c& F6 s9 h; o! D
* `2 C3 c( Y: D8 }$ b: k4 j" Z# }/ Kfunction scrollmarquee(){: y6 q! o* c- V$ H+ x, U2 ]3 q% A. V- E
if (iedom){
" c# D9 Z |- ?, Lif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)), c4 U; R. _; i8 Y2 z$ i
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed, e4 |; R* J8 C
else
& Q0 H; P. a6 G; T8 O j8 ycross_marquee.style.left=marqueewidth+8
& n: e- {; w2 z1 V/ {) O- q1 F+ Z
}
+ X2 z' u$ D. m8 v9 Relse if (document.layers){
+ `7 D4 y% q3 h. Y" T# P% l. K7 Hif (ns_marquee.left>(actualwidth*(-1)+8))/ _( F( t; q/ C) N$ X2 V2 e
ns_marquee.left-=copyspeed4 f b& A9 e( L! G; [! n2 O5 o
else% q$ ?7 V8 O0 |4 C2 n0 n
ns_marquee.left=marqueewidth+8
/ {; Z' |. O, {" o5 d) p}( r& |9 b- C' N" O& Z1 H
}
. u5 P0 _% A! l
3 C! U. ^4 e$ ^: ~4 C! L1 U# E _8 ]if (iedom||document.layers){6 e4 j) L3 E" g. @' c
with (document){4 g8 }. e2 O, C9 N
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
' i; m% ~4 ]$ oif (iedom){
' w+ O& p: {9 q: L+ z& ewrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')1 W0 ~0 M! N# B! ]4 c
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
" }. ~$ U& @& y8 h. F; L# Ywrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'): p' F) O4 h. n6 l7 `
write('</div>')2 F4 F }2 x& D: m3 ^" F
}
% m; V6 Q: s8 Nelse if (document.layers){' H* s( a4 N t% @# C9 q2 f" ?4 j
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
! L0 ]5 D/ ?& n3 M8 J6 pwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
6 p4 H I3 S$ L" t1 l2 Rwrite('</ilayer>'); e% \+ a8 z3 `
}
# S( |/ H. X( v! ?& b. s Ndocument.write('</td></table>')7 R& k$ K( {4 |+ E! Q8 [
}7 K% H, G* F7 I, o
}3 h: w% j: T' [
</script> |
|