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

|
网页之跑马灯文字特效
//修改宽度' n/ ]2 {+ O9 S
var marqueewidth=300
/ o, h9 o8 |+ _5 V' r' [0 T6 o//高度/ [1 ?. l% X3 L V7 S
var marqueeheight=257 t' z6 g4 t8 w) p: O+ p, u& H
//速度(1-10)
2 f9 t- O8 W' Ivar marqueespeed=3
% z' B$ t6 D8 c3 U//背景颜色
6 ?( G. g6 H2 Pvar marqueebgcolor="#FFFFFF"9 ^& U$ H9 `2 C$ o" G/ n
//是否能暂停 (0=no. 1=yes)?) X/ P' S! |& `/ B
var pauseit=1' ~9 L2 V) q: K! G# Z! t
, G6 P' d ^4 Z. N$ M5 S
//修改显示内容
6 d+ H2 i% h$ F: p% p) Mvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'' q& W* \" Z8 R* R+ \0 l
, C- B6 } _7 h- E3 H
: U. X. x L% ^# P) {6 Y/ U
////下面不需改变////////////; g; T! i- w* t b o
5 a8 R: e& {) r" \2 F4 ~
var copyspeed=marqueespeed4 E" J& J$ b2 t$ o2 y4 q
var pausespeed=(pauseit==0)? copyspeed: 0: f! d: W, [7 G! t/ ~- v# a D* _
var iedom=document.all||document.getElementById9 h' U" _! x4 H2 {
if (iedom)
1 i8 \; m& ^4 b' cdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
0 t+ v/ R, W) [! k$ y( p K5 `- G& Q; `8 Fvar actualwidth=''# a5 {- G0 q. K: [- z
var cross_marquee, ns_marquee7 R: c: F/ }! X1 s
( N- W @! @" I* A8 Pfunction populate(){
; {' e$ I* O* x# Uif (iedom){9 |: a; ~6 f/ r$ I2 W
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
$ A, [% j1 J( D! i4 Tcross_marquee.style.left=marqueewidth+8
7 q3 u1 y) o; c1 [) o6 f. kcross_marquee.innerHTML=marqueecontent# }- F# }/ M2 z: e: C: }% u
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
+ g9 |0 x4 \$ I% S. k! h8 s}
9 y a8 U! k6 u6 celse if (document.layers){% x$ t% B O/ h6 q
ns_marquee=document.ns_marquee.document.ns_marquee26 L: P# S5 H# I
ns_marquee.left=marqueewidth+8
2 \5 l* S ]5 Gns_marquee.document.write(marqueecontent)
& O' }, `* t+ ]' w& [ns_marquee.document.close()
/ a/ d3 ?5 X* z/ M- ~actualwidth=ns_marquee.document.width, y( }4 i- W( N8 o: N: G5 g' Y
}1 ]2 F3 [7 b. i& M
lefttime=setInterval("scrollmarquee()",20)
- @ G) x& w% U* H7 _ ^8 n}
7 Q9 P2 Y! F/ O9 e" M3 s1 Iwindow.onload=populate
/ I: A' g1 X! J1 A6 N) Z i- f; W; y/ T0 c0 ^9 t: p! b
function scrollmarquee(){
; J# t# {" U# Z" W1 ?if (iedom){
4 H3 g7 Y7 p& D8 ~; x/ \6 ]. Nif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))% `* X! O. j1 m, {: ~
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
9 K1 ]2 L) c2 M! P3 Yelse4 N6 x4 j( ~9 c4 n' V- p! s
cross_marquee.style.left=marqueewidth+8% y+ b1 m' u% Y; k$ y4 f
- ^2 V' ?; o, E/ N) o5 U# Z% d
} T1 V% g% v5 }$ a* Q( C$ h
else if (document.layers){
; J! k7 m- M5 Jif (ns_marquee.left>(actualwidth*(-1)+8))4 _3 @* \, H! j$ G' j6 z! q
ns_marquee.left-=copyspeed
" |: D: Z( i" delse
, w e, C1 p- F& Z& Bns_marquee.left=marqueewidth+8
/ t. z0 M) t7 F0 O% I) \}+ Y$ R5 `9 X" x' B1 a
}# w/ g% @1 x6 c4 ^
& Y5 R8 P ?" u5 {( E/ { q( b2 L* W
if (iedom||document.layers){5 N |5 \, X4 o; r) Y5 [
with (document){9 ^* u" P' h ^6 r2 ~" I
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
k) B! f& |! u% k4 M7 dif (iedom){
9 G6 D9 f( W& s! R5 ~' }0 ]write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'); L/ S/ G! Y1 { {
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'). o+ D( t6 X' s, u% H# v( T7 M2 k4 e3 |
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
% W" T, O8 H C0 @% L5 y; R5 lwrite('</div>')
9 c5 q) q- ~# J4 o+ j. Y}. X( w6 X5 c) j( ?2 v
else if (document.layers){1 }* i# O6 i9 w1 J* w v
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')$ J1 q$ o' \6 \9 U- D
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')) Q6 ]( H1 ^& [8 b
write('</ilayer>')
/ @. K6 G. f$ f2 g}
+ s* p3 U5 u0 O* \/ |( Rdocument.write('</td></table>')( Q3 F0 _2 [& F! H1 f! M
}
( d% k1 m( R, z% @}
1 }% o. a# { K1 N/ d% V0 Q</script> |
|