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

|
网页之跑马灯文字特效
//修改宽度, U8 x" z3 M9 V! C5 R9 N4 Z
var marqueewidth=300/ q2 W9 }" y9 u" }" A1 `
//高度, z$ R8 f t/ n/ ^
var marqueeheight=25
# b: G% s# o( E% N4 K//速度(1-10)
M) g4 r+ U jvar marqueespeed=3
3 u0 \6 W% V; H7 a9 Z//背景颜色8 |; N- a. I+ O+ ^# n
var marqueebgcolor="#FFFFFF"- D$ _$ y7 M5 F }$ I0 }3 T( i
//是否能暂停 (0=no. 1=yes)?
4 l! c; j" n& Lvar pauseit=10 U" d) t6 {/ v/ b% \( W2 J
3 V! { e. Z+ x* w$ y% _$ U
//修改显示内容
+ j5 q: Y3 V$ k0 u5 s1 H- tvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'# u0 n9 R5 s4 R @; g* X* H; m
1 q% w; {* V1 T& e
4 q0 P8 e. A# d0 l9 E& [////下面不需改变////////////" U+ f# R! D7 Z, Y
; d& H) D' {, t# C& \
var copyspeed=marqueespeed: _- R& B0 h% S$ \% q/ q, x
var pausespeed=(pauseit==0)? copyspeed: 0( |# w# h) y2 h2 P) x& z
var iedom=document.all||document.getElementById* P$ W8 A* P; h! Y$ `$ }! T$ |5 w
if (iedom). M* W/ q. A2 U. |
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
3 r- T' h4 R& [$ T# Evar actualwidth=''4 }: D8 Y$ y ?& W6 a- J. z
var cross_marquee, ns_marquee
1 }$ v; Q# `. m% w( Q
* R( S& }6 C% _" cfunction populate(){6 Q+ U) f, w$ U; P
if (iedom){1 a3 W' A! G2 t( z! s
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee- o& Q% T8 b7 ^" n, n. T
cross_marquee.style.left=marqueewidth+8
" v5 Z1 z5 G1 O- ucross_marquee.innerHTML=marqueecontent
/ E- b! s! |4 }# C) factualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth1 n# d$ g" _9 Y4 o" {
}6 y+ Z* h' @' b7 q, A% U5 y
else if (document.layers){7 I; ]2 s) X+ m0 p
ns_marquee=document.ns_marquee.document.ns_marquee28 P6 B# d* x& L" @8 g! f: b g4 t
ns_marquee.left=marqueewidth+84 D" \7 U3 C F8 b" {
ns_marquee.document.write(marqueecontent)
: S F G2 s o( r+ F5 Lns_marquee.document.close()
# Y2 S6 A' d( ?( d9 S p: Ractualwidth=ns_marquee.document.width
- ]5 M& s+ s4 d% ]; g6 {$ [% `' J}
; c* z- c2 r+ \, c1 \lefttime=setInterval("scrollmarquee()",20)
3 {, d7 w z! Y+ O7 s}
2 `0 g9 \2 p, |. ~7 Iwindow.onload=populate* P/ o- X& n& D; u
4 u4 o2 \; x/ \
function scrollmarquee(){' g$ b4 {" Z' }3 C- ]
if (iedom){
& A3 M! v, G" m8 \ }if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
0 P0 [2 P2 H4 z5 d$ vcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed" f8 D: ^. \" M* x6 \4 W3 L2 L& R
else
- U( t/ a. N$ I, H% Mcross_marquee.style.left=marqueewidth+8# N! f& F$ ^$ K4 Q1 L( q
' F& v6 H& P: w4 ~8 m* U4 C' z
}
/ ]/ u9 u% J9 U% ?else if (document.layers){
7 `8 ~. A4 M, o: S7 kif (ns_marquee.left>(actualwidth*(-1)+8))3 m d. R; y* z/ X" ?2 o& Z( J
ns_marquee.left-=copyspeed) v* n2 O2 d$ _( S' Z/ R
else
- e7 Z1 T7 Z& M1 q% F% u0 S: Ens_marquee.left=marqueewidth+88 R: u5 \2 }2 u% S7 J. X7 y) s. Y% B9 p
}- ~% v0 F- @7 Z* O- b
}
5 p) A1 g. J' s
! }5 f8 a1 y' F1 R3 H: vif (iedom||document.layers){
; o( |* M2 w8 t Awith (document){' `* T, N/ x0 s* ]$ p
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
1 ]' U. |- U0 D5 {if (iedom){
D9 r$ M* j! t. q3 S7 dwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')2 ^+ B M! c! }0 R7 E
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
2 ~8 x4 I Y6 R! Q, y, C7 D2 E# twrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
7 [* O3 d& w' i0 Q) Z' Dwrite('</div>')
( x+ _4 g/ Z) `5 G}7 A( v$ [4 v& g+ B- K
else if (document.layers){
! T5 ^8 N- R! r/ twrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')* [8 D& W2 j, _# s# w
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')- k" F- K8 B# T. J3 a* \3 W
write('</ilayer>')
6 v5 |* p$ \& U) j2 j5 K}. i6 [2 @) M# r1 Q
document.write('</td></table>')( i! ? U' K8 O2 y& b1 d/ ~
}
$ s, A u7 _) q4 d- q5 a}0 u2 B& J& s- V3 u. R
</script> |
|