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

|
网页之跑马灯文字特效
//修改宽度
; @& _. K$ W. L! d% W+ I' ] jvar marqueewidth=300
; S. Q: Y) u, W, e# u8 P4 L7 H//高度7 |& j9 V* _# e! C
var marqueeheight=252 O, [' x1 a8 w. e' @
//速度(1-10); i$ r. I' o1 }7 K* k7 Q7 ^3 u
var marqueespeed=3
# q5 y' O! T$ |" w' p//背景颜色
/ |( V ?4 M6 ?8 ^var marqueebgcolor="#FFFFFF"
, s9 [1 c5 H- L$ {% @$ ]! ]//是否能暂停 (0=no. 1=yes)?& C. J" r. X7 H
var pauseit=1% |9 Y6 O( p9 N+ E7 e( q
1 ]: W( o9 T0 s0 ?8 N6 s# h4 U
//修改显示内容
8 s" Y+ R4 A$ w& m( s7 Fvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'$ U. f( H% [6 b
1 ]1 }$ ~" d% G4 C, l Q0 l
+ e H5 }$ _( U+ D& ?4 w
////下面不需改变////////////& z% Y$ D/ B6 X. ?. k/ I8 ]0 B
1 M+ f+ t6 z; P" N4 a
var copyspeed=marqueespeed
6 O4 S8 n$ Z0 h* d! c$ x# vvar pausespeed=(pauseit==0)? copyspeed: 0
9 |8 D T4 A+ C$ Gvar iedom=document.all||document.getElementById
0 k) A" V) T0 ]/ H' G3 U/ Jif (iedom)
6 c" O/ d7 \/ M8 {" adocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')* H0 ^3 u( X. W
var actualwidth=''
, \! z) p: K5 e5 j# Fvar cross_marquee, ns_marquee. H4 k5 d& [. H+ V
3 L8 }, \% X; }* hfunction populate(){4 p6 y U& h$ `' e! {
if (iedom){, ?+ \& V F; u
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee( ^1 y) K1 W7 R/ z. z* f- R
cross_marquee.style.left=marqueewidth+8
( P0 k" C+ K2 |, m6 I [cross_marquee.innerHTML=marqueecontent
2 w+ T, E( U4 Zactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth1 v7 f( N: \: }* N7 f
}2 n" h1 M* ^( b, i. |
else if (document.layers){
& } I) V) ~6 K; K k; y6 gns_marquee=document.ns_marquee.document.ns_marquee2 h5 e2 l' g9 W- b8 w( R. l
ns_marquee.left=marqueewidth+8
1 L0 j: w) b1 X4 K6 B; Y4 jns_marquee.document.write(marqueecontent)
8 |, g! r$ I: P ins_marquee.document.close()5 L$ O+ |+ t" {+ i. d2 |5 A$ d( u9 z
actualwidth=ns_marquee.document.width8 L6 q$ b( w4 Z, s, `
}
5 {4 D! ^7 J, g6 y/ z% c; ylefttime=setInterval("scrollmarquee()",20)
/ u* O6 q l; d2 u( F' ^}7 H% N- S) I" {/ i
window.onload=populate
7 ^: E! I. t% w; t+ V- N! \* ~/ b2 T! v6 P# L) o6 ^' _/ u: N) X5 T7 x, q
function scrollmarquee(){
5 R$ Q) }7 ^' Oif (iedom){
5 H3 J3 x9 C) O7 ^0 M* xif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)): O: q5 T; d! G( w9 y$ d0 S- f
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
5 ]6 A" ~: Y8 t! }9 E' Eelse
: Q" S) j4 _& L3 h( ~1 vcross_marquee.style.left=marqueewidth+8
+ \8 W0 T) U6 s* Y! d, Q' n" h& h7 z; X- V+ Y4 G
}( O2 A! J1 ]! m$ P+ P3 }
else if (document.layers){: S" K1 i j8 g9 O o8 z0 u
if (ns_marquee.left>(actualwidth*(-1)+8))8 ]8 R6 m2 {: M' U7 j$ F" n* @# t" O
ns_marquee.left-=copyspeed
; {" ~) q. V$ @/ xelse# y; I7 E8 \) B' e7 @$ @; {: R' U
ns_marquee.left=marqueewidth+8
8 |; |0 J& x9 J}2 q( _, k q* N- ` f" Y
}7 t& M# F( v E5 q
9 H, k/ P: R8 z% v, _4 }- Q: {. s
if (iedom||document.layers){
5 K2 B' n9 @1 T5 Kwith (document){2 u- T( Y5 y3 q
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
% q5 e+ z5 a% D( m- `9 J# kif (iedom){
/ y7 x$ y+ W% }& j Ewrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
+ \# b0 s# z" \6 D/ _write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
/ D ]! `( Y; w/ `+ `write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'). f* \- Q8 o7 P/ d _2 x
write('</div>')1 {9 v" P- \7 K$ K3 {9 T
}; f3 e8 `3 G# O: p" {
else if (document.layers){1 Y4 U8 }# v* P `
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
: d g+ w4 z4 a* qwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
9 v) {. C" G7 B. [' d# o2 O- ~+ Zwrite('</ilayer>'), H5 N, h. H! ~- u D @
}& j: |* k" Q" O4 l. a4 I2 P. d: C
document.write('</td></table>')! M2 @8 }/ H8 R" W: B3 ^! o
}8 X( t: ]7 e, Y7 Q
}' F0 j# @) {. y& x
</script> |
|