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

|
网页之跑马灯文字特效
//修改宽度4 x0 z6 A8 z/ ]5 b! n! @
var marqueewidth=300
! Z1 u3 ]6 Q0 j) U7 M% z//高度
6 ~; j/ N0 o: u/ }4 F! n" b1 fvar marqueeheight=25
0 x% Z! N: M, y% N+ `+ |//速度(1-10)
( G b6 R- q+ F' r/ I! f! a9 Lvar marqueespeed=39 [7 M/ s$ S8 x Y- L
//背景颜色
y; P/ ]4 u. B8 u& @/ Kvar marqueebgcolor="#FFFFFF"" |: _9 j% h/ P. s' p
//是否能暂停 (0=no. 1=yes)?3 u ^. C9 E/ e* l
var pauseit=1
4 {- L I2 o; q9 W1 v# r
7 R: P5 x4 z% r& Y0 Z; Z5 i/ M//修改显示内容
; [- @ Y2 e7 r3 w* ]" tvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
6 z$ n+ J! u# R J0 b, {: v a7 e1 Z! t+ q$ J7 v# Q' y/ Z
! v& J, J4 h6 t! d////下面不需改变////////////
3 I" z: u2 f0 q. t+ t9 _
6 I9 Z; _) H1 L% y: r" p( @, Fvar copyspeed=marqueespeed9 e5 q0 Y: S7 u7 [. [4 E
var pausespeed=(pauseit==0)? copyspeed: 0) `: A; A2 G! N/ v7 Z8 Y8 R
var iedom=document.all||document.getElementById
. z$ |6 H: Q. C8 S. Z. B/ Qif (iedom)
5 ^$ N# u1 m5 Tdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
' i1 Q2 u4 _* t! qvar actualwidth=''$ \- I; P. R- H) H
var cross_marquee, ns_marquee
7 V* Y' b" F7 }# h/ A+ n6 I# |% f+ v8 z2 } W
function populate(){
! ?+ w5 y8 ]( m# Z# G7 Cif (iedom){, O. o& E# I# a: k) G
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee) g' }! L( s- X* k
cross_marquee.style.left=marqueewidth+81 _- G+ w2 a! P$ t
cross_marquee.innerHTML=marqueecontent4 L* M% R# c& X9 V
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
7 k$ k* [/ |/ S$ I: F) b# P}2 w/ {$ Z1 K6 z3 C
else if (document.layers){
' g* {8 R9 X# F* f7 ens_marquee=document.ns_marquee.document.ns_marquee2
; i' v2 ]5 ^5 o) cns_marquee.left=marqueewidth+8
: j* w8 V5 Z- ins_marquee.document.write(marqueecontent)
; i1 J$ A! W7 ?' R5 G: Tns_marquee.document.close()9 u6 M3 b( p/ U: ~6 W
actualwidth=ns_marquee.document.width9 |: n* F; Y+ ?. `# q
}* B3 ~. E; y/ w% ^! d
lefttime=setInterval("scrollmarquee()",20)* W; E* D- Q/ v
}
( n" Q8 P5 X, p: W# i" ?window.onload=populate0 M+ D/ s$ R% z D
3 T. E3 u- @( ^7 efunction scrollmarquee(){
3 v& K8 t( I2 j! d& b- Rif (iedom){
! q1 M! ^( v: ~( u! g% b1 yif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)). O0 O; {; b2 ]8 h% ~% O
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
+ Y+ u8 M) i; A5 S+ X( p0 |+ ?else' X& L* w2 P2 p. A9 o7 o' S
cross_marquee.style.left=marqueewidth+86 G4 x7 J V4 H8 \
! a& @0 a: a8 X' V, w4 L
}
3 Y8 \# T9 Z, f8 G, n$ G. Belse if (document.layers){
$ q( [5 C. s4 I" {if (ns_marquee.left>(actualwidth*(-1)+8))% J$ v E! c/ Q7 k) Y
ns_marquee.left-=copyspeed* k7 Q% v5 _! d( M8 A
else
. K. ^7 i |- c' r% F* }! `ns_marquee.left=marqueewidth+8
: m9 e$ y% o0 r0 T, w/ U; i; S}
& N% {' `8 n$ |1 l7 z3 p+ j}
. A9 m9 \8 ^+ D! d% ?, m
& [. N. k# A9 p4 s9 i. _6 B: E; oif (iedom||document.layers){& Q- u- L8 u& ]( h- a
with (document){
6 R5 ~: U% a0 L% o2 z) e4 x# ^0 zdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')3 N! K) o' w. Z4 }) J, G
if (iedom){# \! W4 x m! J2 I, E
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
: S5 h; M$ M2 u3 lwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'); D0 Y! d# u9 n. D
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')# t9 C7 n- t/ r% N0 G. T
write('</div>')6 @/ `% _" e! N `
}! Y3 J$ G4 Q4 o5 K- b2 P% @* C4 ^
else if (document.layers){
6 B+ @+ @+ s: a K3 X4 t% iwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')) Z) E- r9 _$ h( N+ L+ {, R
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
3 r% b3 W; A h2 B* I# ^8 hwrite('</ilayer>')* V% m4 r( r4 q3 ^% D* P
}, X) P! [6 j$ W* @& |6 Z: M
document.write('</td></table>')
/ z6 ^4 b4 R+ j! ?}
& z$ ]# i8 w$ k. N3 r}6 Q7 T1 M+ L! Z" ~3 @" W. _
</script> |
|