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

|
网页之跑马灯文字特效
//修改宽度
; e! g1 f: L, bvar marqueewidth=300
# ~% h! {" C" n2 E1 |3 E1 U//高度
4 y* Q, _! c8 B% v. k) yvar marqueeheight=250 \- I( H0 d( _, U7 Z- [
//速度(1-10)% L. r7 R' F0 ^+ X C
var marqueespeed=3
% O, L' ]+ c8 z+ m$ V5 O//背景颜色7 M$ d& F# z; J5 W
var marqueebgcolor="#FFFFFF": R5 h* N$ o5 n
//是否能暂停 (0=no. 1=yes)?- z3 [/ f; o' z. j* j8 Z
var pauseit=1 B/ W; W5 f# X( z. s4 e+ w
$ U T$ b! i8 H; ~
//修改显示内容
( j, L* s4 A3 ]- [' Mvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'6 ?; x4 p U- H
/ y v3 J( W {: f
% s3 {" B3 ~! |6 }/ F////下面不需改变////////////9 v1 _2 C6 B9 u5 O; b. w
3 b# a: L2 j4 W0 u8 K2 s0 r
var copyspeed=marqueespeed( F5 A; h3 S5 k/ ? I, Z* ?1 Y
var pausespeed=(pauseit==0)? copyspeed: 06 {& M% A6 W6 w- d1 G( F5 I
var iedom=document.all||document.getElementById
* Z! {/ s7 }4 C3 \$ g2 C3 sif (iedom)
. d2 i# [' y* Y" @8 } Sdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')) ?1 G, g/ Q4 |
var actualwidth=''
M$ K D: M" v3 Vvar cross_marquee, ns_marquee
6 e/ m. s* x1 d
, `+ C4 i/ V. y# Wfunction populate(){" e2 O; t, u3 H0 s7 k2 E
if (iedom){3 a$ G4 z3 }7 X4 e
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee/ k1 d4 ~8 I' r4 U0 u2 o9 x7 P
cross_marquee.style.left=marqueewidth+8
' W+ [+ q; y Across_marquee.innerHTML=marqueecontent4 s& ?$ P+ D- d) K8 X
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth; o: J9 B* U, I9 \
}
: d# e) q- f8 e+ j! @( @else if (document.layers){! T, I. j: {" m( X! C+ d4 H
ns_marquee=document.ns_marquee.document.ns_marquee2
$ O p& t' U+ Q6 Q( w8 B: v* Yns_marquee.left=marqueewidth+8, f |0 F4 J& x4 ^& q5 Y% l
ns_marquee.document.write(marqueecontent)
7 ]* B& g' t1 ]. W4 X, W6 wns_marquee.document.close()2 Q- F4 ~3 }4 D
actualwidth=ns_marquee.document.width% @" ^2 [, K2 g; d
}: M5 a8 J R, i
lefttime=setInterval("scrollmarquee()",20)
6 y1 ~9 j4 q) `+ D8 C}
7 w4 e" O7 h1 J! ?3 n8 ~window.onload=populate
7 ?1 |. _" c, R8 S5 |5 H3 p9 r z6 U; n0 m0 {! k6 g
function scrollmarquee(){
' h! s2 F s: Y! j. c& B: Xif (iedom){
7 V. r* S! ~2 E+ p' Wif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
' ?. l8 p; ?2 T8 xcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed- Z9 L, |% [9 h. k/ y- ] ?
else6 Y0 s4 Q% P% z% w, r& j F
cross_marquee.style.left=marqueewidth+86 f8 G/ H& _3 G4 w8 ?/ p: k7 @" v
* }4 ?( k! Y7 n) C8 Q}! W: q2 b! [; ]5 |: _' M; s' a5 v# A/ f
else if (document.layers){
: y' C& p2 I, k8 m0 p# A4 [if (ns_marquee.left>(actualwidth*(-1)+8)) Y3 |) g# l& l7 ]- h1 q0 T
ns_marquee.left-=copyspeed
) L) }* J J3 q" j3 }1 [. Helse% h0 k! ^- @" m
ns_marquee.left=marqueewidth+8
3 a1 J% j) H$ U; J4 \; D7 B, c}
/ i' |0 n6 s! B& r, l; C# J}/ w2 m9 }3 J; P/ W
/ K. |+ C; h5 _5 ?/ q
if (iedom||document.layers){
' p1 [) J% H6 P4 ^9 j7 ywith (document){. ^& {8 i3 h6 o& _6 |$ X
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
! m! Z* g8 {6 b3 Sif (iedom){
2 s! K0 C4 F8 awrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
3 N9 K. X% e; H! y# ?0 O6 fwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
- ~7 Y$ H2 I% s1 F8 B: ]+ _' @write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')0 h5 j! g* V& H3 Z; z' U9 ^( d; ]6 Q
write('</div>')3 C- x9 \6 s8 l; s3 G/ f
}: n' J% n- N X) z. R& r
else if (document.layers){
- i+ u+ t( y* P: T8 W/ mwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
! N, o# J: ]) b w: L! I$ \" u- ]write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
/ t. ]7 r5 P' \- g/ O2 i$ qwrite('</ilayer>') z- h. ^1 p4 k3 `9 K, B' d3 N- d
}
9 f' r) M% t* ~document.write('</td></table>')( V% y% B# J: d* ~0 o* z7 y+ N; V
}
0 k0 E9 B/ H: {: K8 M( u, X}
1 D' L) c" A: _" \</script> |
|