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

|
网页之跑马灯文字特效
//修改宽度6 j9 U a5 n& S' u# ^
var marqueewidth=300) q6 Q3 V1 ^$ S: z) M
//高度
! J1 V4 y# N% I1 T8 y. N* e5 `var marqueeheight=25
6 `, M. Z* T; k3 E' z& r. \: [& D//速度(1-10)6 t+ Z) k2 F( Z; C# Y
var marqueespeed=3
, \6 a/ M8 T8 ?6 A% d4 V0 k//背景颜色1 ~& F% x- C! w8 L. F6 { A4 V
var marqueebgcolor="#FFFFFF"
! o$ U4 y2 ~7 c7 \: b8 |( A) O' h//是否能暂停 (0=no. 1=yes)?
- ]3 W* A" d, b |var pauseit=1- C) J* ]" `( G7 T
# E% _' [: a' g
//修改显示内容
4 {6 q( x7 l9 R H, pvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'% i+ d$ v3 Q5 A# M! ~
6 N- f2 L- Q/ \; t+ l
, o1 a5 s9 |4 x% N
////下面不需改变///////////// b& }7 V9 V6 p2 v& R4 l
3 I2 a3 w R R; Cvar copyspeed=marqueespeed8 c4 S& Y5 `) I- ~6 B
var pausespeed=(pauseit==0)? copyspeed: 0" P+ v+ s Q2 ]0 p8 B! C8 w" R+ ?
var iedom=document.all||document.getElementById
+ d& ^1 ^! Q3 Q/ S0 f: Y1 a: ^if (iedom); N, Y% R' i6 m" z% W1 c
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
5 V4 Y4 ^( g; r+ u) _2 f1 \. }var actualwidth=''
# M0 x% w) ]0 V- ? K U. Pvar cross_marquee, ns_marquee! e6 W* { A; F. x. v W6 {
6 m. B" Q7 Q- S4 ^( J
function populate(){
& o/ v, O& U! V* C9 n' X8 w: b3 Kif (iedom){4 O0 X7 ?+ i; _2 j- \0 V# c# [" L
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
( k! i' n: N5 C" \- h3 vcross_marquee.style.left=marqueewidth+8
+ y- I! G' I% j- ^. icross_marquee.innerHTML=marqueecontent$ J4 P0 K( M! V
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth5 \2 A% O T! k6 k! w$ L" B
}" }' Q5 a4 w$ J6 ^
else if (document.layers){+ \& _" `9 u, v, v
ns_marquee=document.ns_marquee.document.ns_marquee2, h [8 a' b4 I# w" b/ P3 Z7 |3 L
ns_marquee.left=marqueewidth+8
6 f& l7 z$ d- h8 Ans_marquee.document.write(marqueecontent)
$ M' u2 o" C, lns_marquee.document.close()
' c7 [5 D6 i8 Z$ y2 |& Dactualwidth=ns_marquee.document.width& I' H2 T0 l/ k1 @& [
}7 L2 \# M. G7 s5 k% y/ `# ~
lefttime=setInterval("scrollmarquee()",20)
7 e7 F. x0 c& S* `2 }) V" g}
% I2 O6 g8 g; P/ O* T. uwindow.onload=populate' r9 C7 G; r* {- l
: X% N% H4 a" R7 i7 i$ A! @
function scrollmarquee(){) l1 r3 F% D5 g: t! x( ]
if (iedom){
8 k, H& N$ k# V( P" C9 N/ y0 l0 Z- j) pif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)), y7 L; G6 L2 \7 d; }! |
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed; C7 [, i+ l: \% G
else& n' N1 M. t! v9 A
cross_marquee.style.left=marqueewidth+83 \0 E1 U/ b& O) c' w9 r
1 s4 ^$ h, Z# T. Z& t
}" C2 C+ H+ t; B! H. q- [- t
else if (document.layers){
" K. J$ R1 ^' a9 Fif (ns_marquee.left>(actualwidth*(-1)+8))
, I& Z( t# k" uns_marquee.left-=copyspeed& |; B1 {1 A$ B- T+ r- J1 M
else9 A( g. T! q# j
ns_marquee.left=marqueewidth+8
; Z/ `2 ?" b. g0 ^6 \. \}
7 u( A6 h' ]1 }. K$ Y1 P7 w8 |}
. Q: I2 ]" v' p/ O+ k0 j
6 B9 K- y- l# Y b) s2 fif (iedom||document.layers){# F& W' x6 r) D* [
with (document){
9 l& b0 m1 }8 k9 g udocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
# s8 y6 t( I' V; W& \if (iedom){
; V$ U9 `* _9 A# {4 h( `2 x, Qwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
- X% D. i/ B8 J8 \7 h& z8 e2 Zwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
5 ~7 J* k9 x) Y4 Swrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')# W/ t2 O+ C. i0 X- G2 d
write('</div>')
1 j7 O+ q7 a0 a4 Q}
, _1 |4 ?3 t# I* h) ^* melse if (document.layers){5 `& m' b/ D0 O
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')8 j2 q7 }; w/ {5 Q- ~' ~1 i
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')" f" O4 c; g6 ]
write('</ilayer>')
1 a0 N; \( P( ?* y- H}
4 d* S1 {* a# W& d2 l7 `6 cdocument.write('</td></table>')3 Z3 B. ~$ t' c+ i
}
: f: B, E: C+ C( @0 ~6 z}2 q* E9 u6 r) O" {0 s
</script> |
|