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

|
网页之跑马灯文字特效
//修改宽度
4 d G& I7 f( e; y- n' Jvar marqueewidth=300: E- U1 k5 v8 C- e7 J# i9 f& ~. X
//高度! n& K" ~' d! Q! b6 ^
var marqueeheight=25
R1 u! y; |6 W! w" @: p$ N- [//速度(1-10)
- R) f* \) ~, F# r! @( g! evar marqueespeed=36 f5 y% t. [$ w( V0 r) H, y
//背景颜色& P7 Y" {, w6 \* v
var marqueebgcolor="#FFFFFF"
! D2 t, s, q+ f//是否能暂停 (0=no. 1=yes)?
3 h& T$ {. N* R( l7 r% E( F. ^var pauseit=1& |1 C% }# }* B5 }- y
5 d/ E* `' x- @ N0 G' K: Z+ s, \//修改显示内容8 v$ w+ q8 R1 q! {8 o
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'( I K/ Z. i& e* K
( P% \+ s. \, {: K& @
4 e1 _4 T% A8 b////下面不需改变////////////
7 J/ L9 I, I u4 W. E/ x" R- ]- T4 V* C) s9 W. M# c& \
var copyspeed=marqueespeed5 k# D( D# K# H, N* Q7 z! d4 {
var pausespeed=(pauseit==0)? copyspeed: 0. ?9 j* ?3 [4 |- Z2 N; e/ h7 Y7 b
var iedom=document.all||document.getElementById
( b7 I J, p n7 _if (iedom)# i# x7 c5 Q6 x' O+ j# N' \4 |6 F* b
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
/ |5 |5 [, V, Yvar actualwidth=''
2 R* f( J$ t1 |" U# p0 ivar cross_marquee, ns_marquee
6 H# a% D" f. W2 S
' K1 [9 q% v+ A# b4 \function populate(){# {5 R3 A: x( i- q4 ^" n
if (iedom){0 F( X& n9 T: P3 p, q2 j- l
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
0 C& q' k+ @3 K/ ?2 x- F, rcross_marquee.style.left=marqueewidth+8 f2 U5 b: `& l F- f
cross_marquee.innerHTML=marqueecontent- K, E6 n' \- J+ J1 \* h
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth& q s) y. s! x; J9 V/ {
}
2 m. n8 w: N) w ?7 Xelse if (document.layers){% w' Y+ V' H6 b1 N6 {
ns_marquee=document.ns_marquee.document.ns_marquee2; I: b( J/ }% r
ns_marquee.left=marqueewidth+8
. [* D8 r N( E1 D6 hns_marquee.document.write(marqueecontent)
) Q% ^ s- b; I; A& ]7 {ns_marquee.document.close()
- I3 k! s( `8 w% Yactualwidth=ns_marquee.document.width
+ o/ a- W \. i9 l: a+ U z, z$ `}
4 v y5 D6 s7 d% j# `- Alefttime=setInterval("scrollmarquee()",20)* M* u. s) o8 J) L1 M; d
}; f& @- [2 W. }
window.onload=populate' @* ?; E4 n; R2 a" Y6 Y* k: R
3 ?# `; N% h, l7 w
function scrollmarquee(){
1 }4 {9 h. l5 P1 p/ L4 gif (iedom){
$ T! m1 m. Z9 m [# v1 Qif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
) ~ Q% _. l, N( ~1 Rcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
# s" A; K3 L7 h: delse
8 h3 Q9 R' `# D0 a6 C8 \) l2 ~cross_marquee.style.left=marqueewidth+8
( m! U( [! P$ } E! l2 ~1 c( ^9 K- E$ N% c6 O
}
9 J# J" @8 _& o8 Qelse if (document.layers){. l2 ]# t, P. G+ F" m
if (ns_marquee.left>(actualwidth*(-1)+8)); B8 h/ [4 I% Y/ ^$ \
ns_marquee.left-=copyspeed' S+ w/ A f# r: f. m1 }
else
& w8 ?' ?$ D5 c$ e) _ j+ E/ L0 T) d5 ons_marquee.left=marqueewidth+8/ H4 i& [3 \: @* W$ Y
}
9 O# E9 \( _9 O! N}2 X+ B, y- `' Q/ } t" n: ^
0 @- N- [, L" w' tif (iedom||document.layers){
' b$ s9 V# r" uwith (document){
! B3 |: Z# I: F1 k; Q2 c0 zdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
% Z% ]1 z( W/ K5 V+ ?if (iedom){$ h: r9 @! T" @4 E& y8 o
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')+ L: Z* k w8 x$ Y
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')3 x. P. [. S8 E) X9 v( [+ e" L0 ~6 z
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')% R1 T, @7 z7 H. G- E
write('</div>'): ]% S- F1 B" ^1 c
} W/ O* `% _3 T$ |
else if (document.layers){
# ?! D: b2 L( J' [! W0 ~write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')& t1 W- p; O* C; A( h2 R
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')& ^9 g2 g( S5 Z/ n
write('</ilayer>')* ~0 `9 e: F/ C
}
# q7 \+ E6 \2 j, xdocument.write('</td></table>')
( V4 p# L$ z, a: l} J) _) q0 M6 E& p t9 [" L* Z% O
}* p( e, K, w9 t2 o6 O
</script> |
|