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

|
网页之跑马灯文字特效
//修改宽度
3 h3 V: t! u* d: j& Q5 Jvar marqueewidth=300
4 U4 s2 y3 o" d, U' Y, E g, W//高度: _9 _( m1 `9 N( H
var marqueeheight=25
$ d/ B6 V Z7 A//速度(1-10)
: U* D6 c0 B n jvar marqueespeed=3
4 G3 Z/ I5 V: R6 C//背景颜色
) w$ z1 c7 `5 t& G2 L7 Dvar marqueebgcolor="#FFFFFF"/ Z! h5 s+ W5 u& S# D
//是否能暂停 (0=no. 1=yes)?3 D, ]" ]. N" L
var pauseit=1
4 A! e; n4 X8 B$ N. L# m$ f0 U# b H
//修改显示内容
& `+ N/ [8 x) Y" Q. G* qvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'+ k/ c" _! t3 J+ [$ C# n
; ]1 `/ x2 a/ j9 Z7 q7 r3 w5 D8 n$ c
////下面不需改变////////////
2 w$ [9 U& l7 Y# Q; y3 h: t1 @6 C+ t+ G0 A8 F
var copyspeed=marqueespeed
5 r$ a1 \* u- Dvar pausespeed=(pauseit==0)? copyspeed: 0
# T' ]6 c( s) F$ ~0 R+ I# U7 |* xvar iedom=document.all||document.getElementById+ |6 t. P: F0 Z4 o8 C* O
if (iedom)
% n/ C' F, b( s+ V+ \' s d2 v' {document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')0 d% J$ \4 C9 q+ O- B5 h
var actualwidth=''
* B k! |7 e) Z L! ^! X$ ^var cross_marquee, ns_marquee( Z$ O! C7 `2 @
8 [4 `3 G8 }1 U4 I' l" j& w0 K
function populate(){
+ H2 s$ C6 k% Q; ?# Bif (iedom){
4 q& V: M4 K, I0 pcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
3 ?: G2 N* S# Q+ c0 hcross_marquee.style.left=marqueewidth+8/ m4 F2 F8 a( G( j3 W E
cross_marquee.innerHTML=marqueecontent' f) o9 }6 Y! k6 k/ H
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth$ z+ A! g3 v9 S) S% F6 Y4 S
}) C' w/ F0 T1 U. S8 Y
else if (document.layers){
+ `) a" h9 \9 d* u7 C3 E1 bns_marquee=document.ns_marquee.document.ns_marquee2
/ L5 J4 {+ l# ]9 Z" r/ Kns_marquee.left=marqueewidth+8% S- o) o! R7 f9 }1 b, d3 [
ns_marquee.document.write(marqueecontent) z& [" A& V$ I
ns_marquee.document.close()
+ L0 K( p% c5 Q3 F' Aactualwidth=ns_marquee.document.width. R( K% v- A2 {1 q$ Q* Z9 h
}" P9 U9 M) z! @" ^$ }$ v% l4 l6 a2 T
lefttime=setInterval("scrollmarquee()",20)
* k) { w' ?9 d8 ~* ~$ P}. |1 M/ o0 j4 H
window.onload=populate
7 @- F- x+ @3 M; t6 T5 }/ I5 z6 Z! D/ c
function scrollmarquee(){
1 S' N7 x. ], T3 q G: _if (iedom){
4 D/ ^9 |' g B6 y6 `* oif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))! v% V3 G7 ~8 a1 y6 Y2 \
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed0 I; A2 _5 s& e1 [6 s
else
& |' `; I% M {3 v# p- lcross_marquee.style.left=marqueewidth+8% U& m1 ] D" J1 P5 p0 s- n) }) h
: p0 t+ R, |9 N3 Y- `( N9 ^}
/ Z% c( J7 ~' z; E) ]7 _else if (document.layers){
$ g! j& h; d, c2 V3 f6 Hif (ns_marquee.left>(actualwidth*(-1)+8))/ |/ I: u! Z" S1 x5 \# p
ns_marquee.left-=copyspeed
' |! f, u7 H$ G, @6 m5 kelse/ B' a: H4 Y" L- A) h% X/ [4 M5 z
ns_marquee.left=marqueewidth+8 a; U! b( M8 R" I* y$ f
}
0 Q( ?$ O; A$ F# v6 f9 M}* j2 l9 H2 j# b
& L! k4 S6 T% Z2 {/ Y. X8 [6 vif (iedom||document.layers){' x1 o0 b. e7 y7 T
with (document){
5 c9 v6 Y& c5 jdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')$ m2 i5 |6 E3 l
if (iedom){& u2 _4 o# P( A: R2 W3 l
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')8 M7 x" V4 [" [. @
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
! \8 l* t! j! H J9 ~2 t+ I# qwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')+ y. q7 q! T( o& Y O
write('</div>'), L, @, x7 z' n0 U0 e2 T q
}2 l" N, A4 P. U& h, Y' ]
else if (document.layers){
$ [7 O+ s5 X& H5 q& P8 w# Xwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
8 r% w6 _# z0 n# z9 X5 rwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
( O% E% r5 Q6 E3 W3 E Ewrite('</ilayer>')
1 J7 H+ t {, M! r}) v. T7 V! s! R' H! s. Y5 Z0 T* `/ R2 g/ T
document.write('</td></table>')
# M7 [9 c8 S7 p# _) f/ S}
% t5 _3 [9 N; f; g: S( F}9 }6 O) j a1 S
</script> |
|