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

|
网页之跑马灯文字特效
//修改宽度
3 ]4 L7 Q, U! E# m8 N6 T# l0 X/ `var marqueewidth=300
, {5 w: h* y6 j! H8 |5 r//高度
$ y: x( z+ Z; ]& N' |5 Evar marqueeheight=25
k$ p& ~ q4 o//速度(1-10)# \( D7 I6 b8 k2 i( K
var marqueespeed=3
) M9 t! | {2 p* h' N//背景颜色
6 @- p3 z [- N6 {; b% E! \var marqueebgcolor="#FFFFFF"
* r3 H9 }; k$ o6 t& K//是否能暂停 (0=no. 1=yes)?
5 ?( s7 t; \7 R2 b& U$ |var pauseit=1
& K" E/ U$ \) `# o0 I& s9 G: A/ f
: p3 Q% i* `* `1 m, q* `& B% z# u//修改显示内容
8 S6 m8 H& o' \/ o2 I( E/ B! Q- s/ pvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
! k$ C& T# t6 ]! q: \
; e& Z/ l7 p! B! E& ~: @) ~( N
" x3 a" Q5 Z" Z% a6 X5 I% Y3 c3 }////下面不需改变////////////
$ f7 B5 ]6 W* Q$ n3 @3 k
9 Z! e7 v l$ e2 q d' `var copyspeed=marqueespeed
8 g5 }$ s. v3 {" J+ o. ~var pausespeed=(pauseit==0)? copyspeed: 0+ [4 L5 A% `9 m
var iedom=document.all||document.getElementById
) i( X" y; w* x" M7 wif (iedom)
$ t1 x! g% U$ \! Xdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
$ R- X% s7 }- u) }8 a2 Dvar actualwidth=''
. [' N* |9 W6 O# |! mvar cross_marquee, ns_marquee
' w% d" O4 g, r3 y& J& \$ \ h# `( f+ L
function populate(){
8 c) v$ t A/ i) p7 E+ {9 Q, I( ~if (iedom){( }" t* j, O) n/ d
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
6 d# O5 o9 o f2 o+ a! kcross_marquee.style.left=marqueewidth+89 x6 U8 o/ E+ i
cross_marquee.innerHTML=marqueecontent
( `2 P$ ]$ |9 aactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth/ u- ?$ J8 c3 U" q
}7 _9 P" @( b# @, V* V+ M
else if (document.layers){+ m; ? q9 {* L4 b7 t) ~$ F
ns_marquee=document.ns_marquee.document.ns_marquee2
3 X- J, S: P! p" u* ?ns_marquee.left=marqueewidth+8; j* |+ R+ ?/ Z9 m
ns_marquee.document.write(marqueecontent)
4 f2 W: D4 L0 k5 W9 Ens_marquee.document.close()
7 N; T; P: {4 g1 K5 T/ Eactualwidth=ns_marquee.document.width0 E6 E) v1 N2 @0 B1 x
}
- G* R( \+ J4 G% B, z( Dlefttime=setInterval("scrollmarquee()",20)$ {6 P" V& G' d" U4 _, ?# M
}+ i6 _" N; X' [7 \. A5 J
window.onload=populate& w5 }) @! `- G
) h% e7 m" d1 o# sfunction scrollmarquee(){9 x! D6 F1 U8 j D, l( m
if (iedom){4 R5 _. a) g) v1 |3 H3 C
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))1 D3 n0 O7 {! Q* B2 h4 T( U
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed0 o9 m; Q" j$ s$ G
else# w5 N1 K. a; v7 _
cross_marquee.style.left=marqueewidth+8
& S1 Z# p2 p( [9 H6 `
$ u7 h7 W6 j: B# H$ U' F8 @ ?}( C( U" Z+ [& R
else if (document.layers){
* g* q6 q5 |" t! Rif (ns_marquee.left>(actualwidth*(-1)+8))% s' x; I4 U: V1 {
ns_marquee.left-=copyspeed& q: U: U! u4 H. L
else
' k. F8 V8 o# @3 wns_marquee.left=marqueewidth+8
& l8 h# I' y( S5 ~' J}
' j# [1 I+ P1 X0 X- \}# S/ W, D6 `7 C$ r5 `
) t) h L& j8 z
if (iedom||document.layers){
2 x9 V# _' M @; V' ~with (document){/ \" `% i" ?' O, s O" Y
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
- }; y7 R i. f1 |+ O# o0 H7 v" {" a! rif (iedom){
/ K! x, k {! j4 H' `1 k2 uwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
- k& C9 V/ O' C& ]! N' @2 `write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
! a0 G* g7 ]$ Y- y, C5 Wwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>') ]/ x) d9 w0 C" T
write('</div>')- f' {4 K! b7 F8 s1 L
}
) d5 O* r. ]4 o+ U8 b) Eelse if (document.layers){) B; N: Q9 c: N9 R) G0 S
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
2 c9 |0 { V# r: X% }write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'); X% ^2 G- B) }; J- t3 t
write('</ilayer>')
3 T& e' U. Y: a3 b9 b2 G}' {& x7 A0 X) T K" y, @, @
document.write('</td></table>')
1 ^$ Z2 r6 p& B* p; ^* z}
( t( @$ Y6 W' K}
: B5 U# w$ U/ b$ H8 T1 C, K% p3 N</script> |
|