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

|
网页之跑马灯文字特效
//修改宽度* S5 i& Z1 D. r8 ?+ K6 m! w9 Z5 B
var marqueewidth=300
; D& p. q/ ~8 H//高度
4 y, A! b6 u- {1 Dvar marqueeheight=25
' y% A/ d% i% L! {# l//速度(1-10)
5 j& x1 a& e; O, p! h, ?) [) \var marqueespeed=3
9 C! d# F' O" Q7 _//背景颜色" U5 e! \ Y- Z" }1 I1 k) w4 @
var marqueebgcolor="#FFFFFF"# a: \& g7 p4 p
//是否能暂停 (0=no. 1=yes)?6 m* o- i9 E4 A& g0 s
var pauseit=1- `5 Z" W! }' r) w
" h/ p- S7 `1 n( s9 K% _) Q: q//修改显示内容( M- h- B- u; _* u' ~+ t
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
( _$ |' G# }! H1 z: P. G$ w+ k- C4 B5 h5 ^9 Q' ~
H. N+ T u6 T0 U( {
////下面不需改变////////////
0 }) J# M: `* Z- L5 ~7 [4 Q6 {
) ^( K+ s5 H z% evar copyspeed=marqueespeed8 m5 W' I) V" m4 E$ B* q8 D
var pausespeed=(pauseit==0)? copyspeed: 0
4 ~3 e k2 T) I$ w" I' J( j5 }var iedom=document.all||document.getElementById1 C2 j! _* Y5 J5 b% |( R
if (iedom)( j0 u2 q4 ^8 ^, O
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'): [! _' P$ W, y8 F
var actualwidth=''( M5 _' }' ?- P& P- y, A, ^
var cross_marquee, ns_marquee8 @. U3 ]9 X! m! ^; ~- n( }: d+ A
% R$ t2 ]' v. k) M; C1 I
function populate(){4 r- G; @- a6 E) c
if (iedom){4 N. m1 S( G4 r* ?/ u" M) n
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
0 B! ?! A0 q! `0 u; ncross_marquee.style.left=marqueewidth+8; ?, r2 [" r; A3 A" I8 W) E- F
cross_marquee.innerHTML=marqueecontent
0 C8 }* E4 d$ B& I; R$ D$ Pactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth/ o8 l; g, N4 {. Z3 q6 {, a4 F
}6 {- q( E3 j) W& a$ Z; ~& a5 @6 W
else if (document.layers){
, y, i7 w, Z+ X- B! U& Y8 [ns_marquee=document.ns_marquee.document.ns_marquee2: H1 v& k! x0 S
ns_marquee.left=marqueewidth+86 g" V( U* ^2 ?. Z
ns_marquee.document.write(marqueecontent)% z f/ o* ]9 k9 _2 k& C: b
ns_marquee.document.close()/ c2 a9 g7 C1 A* q+ C) O+ ]
actualwidth=ns_marquee.document.width6 A; t( ^, F9 T# M4 y- b7 {7 x& \
}1 k2 F( g$ ?1 a# C" s- H% m7 P2 l. d
lefttime=setInterval("scrollmarquee()",20)# J" X8 y" |6 k' n
}9 W! ?3 z! A' g" K# ?5 C
window.onload=populate
# ]; \4 ~9 k) `0 [( f8 Y3 N" s6 d( h6 |" r2 f' U' A
function scrollmarquee(){
; M/ ?$ ^$ j) u; D8 Hif (iedom){
2 }8 j) C4 G/ U5 N+ L; V G0 Xif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
, o. r+ k0 B0 Y; q2 V# ?4 `cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
7 }7 J) F1 @3 g9 O( q+ } n! h% helse$ z+ m- H. J( ?* C
cross_marquee.style.left=marqueewidth+8" p1 g5 Z2 O0 b0 H1 ^
; e7 J# S7 p- j5 f* m
}
( k- b% S+ n, m" Nelse if (document.layers){" N: k H8 Y/ {+ D9 m1 K4 c
if (ns_marquee.left>(actualwidth*(-1)+8))+ k+ }3 I' u5 h2 W( A
ns_marquee.left-=copyspeed
! X$ n) D7 ~% N: y7 l- u0 Zelse X0 [) h2 S% Q+ ]: J) r
ns_marquee.left=marqueewidth+84 V3 M9 Z% V- ^$ i# Q( d
}
4 z3 n2 p+ r2 c5 f. v}
1 n; u: S* l+ r/ h5 Z; l# d
& L9 Y8 y# [3 [if (iedom||document.layers){
) t6 p. P. Z# w0 r8 _) hwith (document){
2 Q" I+ z# P4 ]- G. |' N7 Adocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')- C9 k: Z% ?4 L1 |$ o/ m& v9 J
if (iedom){
3 C9 }& M8 B: e- U% D; }write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')0 J6 o2 k* {" j/ d! a. j, o
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
# U Q( k& m: @! y. V1 cwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
u! |8 S8 b* ?! [$ |write('</div>')
0 Y4 \4 P4 ~) m; x}
7 J2 e' \; ?$ s" S) I) Welse if (document.layers){4 [: X) N( O9 D4 R- p
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
- { v! Q9 J0 u% `( K4 T, kwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
/ \' q0 \$ ^( c, vwrite('</ilayer>')
. b. v- _* w5 i& M" A1 {0 b}
3 W* P; q6 k# c2 R7 ?- ?+ ddocument.write('</td></table>') ~* `4 ~' E8 |
}
+ G$ [% X( r0 y' o+ V}% s$ z% x& v7 T( `
</script> |
|