返回列表 发帖

网页之跑马灯文字特效

//修改宽度, u" j) T5 R1 K* o& ], P3 q1 w( d
var marqueewidth=300: M) y' u4 u( U) \1 J
//高度
9 F0 s2 B& z$ @* ovar marqueeheight=25
* _- \6 y( i/ C  w4 t//速度(1-10)
- \  L! J+ g+ M) `" N  U4 }var marqueespeed=3* m- U8 b. p5 B
//背景颜色1 P9 ]1 r& {" v
var marqueebgcolor="#FFFFFF"4 O7 W3 L% g% P, y0 U1 ?
//是否能暂停 (0=no. 1=yes)?
; J& `! {  m) z, G) _5 F" ~var pauseit=1
7 J# Y0 _# O8 @- ^$ e& y$ W6 F. k+ Y6 r; J! X2 x& h; |
//修改显示内容
6 G+ O% i" L& `( Ivar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'+ A: J7 f1 ?0 G  {

+ ^" A1 O( C! w* Q+ C% S4 O! k1 g; X& o, l4 Y4 L: D, D; m4 t) u
////下面不需改变////////////
* v3 Z1 Z9 a6 h0 S$ o$ \4 J' f
# z9 ]( W7 a3 p# fvar copyspeed=marqueespeed; l. C# O" J+ m' U. B( J- V. \
var pausespeed=(pauseit==0)? copyspeed: 0' a+ a( W' @* q! M$ D8 t% B
var iedom=document.all||document.getElementById5 M" H' e" u9 @* P0 _% R
if (iedom)
/ _# C6 i9 S% `$ L1 `document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')9 ?. K/ X, P: o1 B$ a) z
var actualwidth=''
) G2 ]8 I. a0 u4 X% a. K: Yvar cross_marquee, ns_marquee
' J0 v/ v" \8 h  s# B; A; E* u% i5 ]3 l$ K) q2 x3 O# c8 ]4 W
function populate(){
) k/ a0 y0 a5 {9 |( c4 Eif (iedom){
, U% G! _/ w( y$ g, pcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
6 Q* z$ Y% f- a# n" ^cross_marquee.style.left=marqueewidth+8
: S# s2 s, R: J$ q+ [  ]$ Rcross_marquee.innerHTML=marqueecontent8 i) r7 \) D- u3 ?9 y
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
5 q" p( x0 w* B, Z( t0 w" y}
. k) b% v6 k- `" helse if (document.layers){
$ V* X5 W: @9 ?, a5 s3 bns_marquee=document.ns_marquee.document.ns_marquee2$ R2 ^3 f# p3 ^
ns_marquee.left=marqueewidth+8- ^3 K7 q0 c$ C3 M5 O& A
ns_marquee.document.write(marqueecontent)4 K8 @2 ?3 f& m3 E5 g; U
ns_marquee.document.close()) z/ q' P! Z3 W1 c5 e2 N/ o: H5 A
actualwidth=ns_marquee.document.width
/ L7 {: v4 C+ b# d}
$ @) _( m0 J# t+ n# B7 |- @lefttime=setInterval("scrollmarquee()",20)' c3 L  f0 K  W# Z' v
}" @' i7 T4 y, l: L" a
window.onload=populate
! e9 m! j  a& I% x
) u" |$ R8 i3 ~7 m9 Hfunction scrollmarquee(){
1 x) c' n1 r$ P  O4 y' nif (iedom){
3 _, z3 Q; s5 j9 v7 E, T, v7 Oif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
% s5 a' d1 b/ q) M' kcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed+ t( o) @6 H" ]/ x
else6 G3 t: f* z6 Q  q
cross_marquee.style.left=marqueewidth+8
% J4 v. ~& S7 g( c
6 q  n% g; b! s* e}
8 T/ q4 r2 a; ]$ ?' v/ |else if (document.layers){
# T, q2 L2 `0 J8 Aif (ns_marquee.left>(actualwidth*(-1)+8))
3 W+ N4 w  D8 Y" e: g' [4 zns_marquee.left-=copyspeed
5 @( s1 M" L' w/ Y" |9 R/ celse1 U+ z! @! @& Q& o0 h5 @
ns_marquee.left=marqueewidth+8
5 u% V8 G7 ~! Y$ {- n' m}
4 i/ y7 c" j8 Z( k/ I}8 P, |! W! _. z. H' o( H

: T# a0 K3 S. S: q* ?9 t+ W' e0 mif (iedom||document.layers){  R2 ]! X; r2 z' F4 ?  z" D; `
with (document){
* @2 g4 y* w- R6 g7 o& r- Idocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')$ D5 j& F- J; I2 G& \/ C: C
if (iedom){) G% g) ^5 R, [# n6 B
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'). x; p8 p  |- B- `7 ?
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')/ F7 v( P& W( ^% p# K+ F
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'). D% I/ F; Q* P! x4 T
write('</div>')
& l3 G6 J8 L: @: j}
+ Z; l9 E/ g! `% welse if (document.layers){
5 x8 K) u0 [, e7 U: L" [9 Pwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
7 R% N3 a3 s8 K' G0 fwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
* a! L7 |3 _+ D2 Kwrite('</ilayer>')
5 q( N" s; k$ c: k5 T) j. J}
% s, }2 a  D" C8 w+ d2 [document.write('</td></table>')
2 G7 A0 r# F0 m6 o# G, |}
$ o  t" _  f; K}
- G" P( M  g! Z& b+ \</script>

返回列表
【捌玖网络】已经运行: