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

|
网页之跑马灯文字特效
//修改宽度2 c+ P; _# O) K. r* s
var marqueewidth=300
# J3 N$ V8 h% Q3 [ a8 a//高度
' X$ C |7 N% D% M; ^* ~var marqueeheight=25
( r3 S4 d& G* z7 c//速度(1-10)
, t: d( p; C! s0 ~, }5 Fvar marqueespeed=3/ `: ~9 U+ Y! Q9 r% I# r! q7 o; X
//背景颜色- o6 Y8 n( Y3 H7 l' c1 z/ l5 t8 j A
var marqueebgcolor="#FFFFFF"
8 B. R$ ?4 `0 m//是否能暂停 (0=no. 1=yes)?- F4 i, F& G$ |8 w$ `" q
var pauseit=1% }8 U2 o' t2 M1 X
, ]& r6 X# z' W! Y( e( I//修改显示内容3 p* {) s; H' y$ J6 X1 Y/ A
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
* V% J( d) U) S; h6 ~
, c0 }. q, e X6 @
; ?, ]3 \6 `3 q8 T$ q" b" q$ i////下面不需改变////////////
$ w4 A. @5 s/ o% A3 F
, j' h* C6 H7 |" }var copyspeed=marqueespeed
- A1 V" l3 u$ i S3 |var pausespeed=(pauseit==0)? copyspeed: 04 y( i' G3 d: _, i8 P
var iedom=document.all||document.getElementById9 o. s3 Z$ t% p
if (iedom) j4 w: x9 y, U% ~+ V
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')5 F. T% X. A4 L# H
var actualwidth='': e, z/ o7 t: a& [
var cross_marquee, ns_marquee; p) Y$ E N; D4 H+ n
1 ?+ v+ |' V9 P# W" a/ l) U9 o
function populate(){
5 \8 q* V: U6 J; F" V6 fif (iedom){
. g: G1 c' E' ]. v: c6 rcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee6 h2 C1 c3 n M' O7 U
cross_marquee.style.left=marqueewidth+8. h1 Y) R. D) J2 m
cross_marquee.innerHTML=marqueecontent
& N2 `/ e: w e# @ ]actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
; P5 P# j# h/ q}% a) c: {5 T2 K0 |" f7 {
else if (document.layers){
7 L( ]' B* l1 O3 M _, Gns_marquee=document.ns_marquee.document.ns_marquee2# X/ V% k8 X% i7 z9 o' G
ns_marquee.left=marqueewidth+8
3 ]6 [: @& O0 k4 |/ `" b# Ins_marquee.document.write(marqueecontent)3 `0 U9 K' k) T1 J
ns_marquee.document.close()8 z: _0 u3 O, P2 x
actualwidth=ns_marquee.document.width
( T+ D% M W0 s5 }}$ Q6 D& J3 I X1 Z! m c4 w* y
lefttime=setInterval("scrollmarquee()",20)! t0 f& I7 k1 X" c, N
}
; `. j1 d: ~& S8 w- e% R8 P Z `window.onload=populate2 {' U$ M H+ D; O. X
+ h- |0 X. w+ m9 Y& I8 cfunction scrollmarquee(){
& b1 i- u4 E/ S1 [' ~if (iedom){
+ n0 e8 T! y3 j ~if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))* {- a# h5 T0 s0 }
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed$ G* |# _- I* Q6 _& |3 o& N
else
h9 v' u2 ~9 Z, T+ Zcross_marquee.style.left=marqueewidth+8+ k5 Y$ \8 a6 `! L- v# U
5 H+ z. k) x4 X' C6 s$ x
}* f, s2 ~7 F0 ~! L. K
else if (document.layers){3 [% S2 z% ]2 e+ L
if (ns_marquee.left>(actualwidth*(-1)+8))
4 k1 @, `# ~4 Q1 S' ~" u; [ns_marquee.left-=copyspeed {* c) P8 _% ]) V" Q9 r
else/ `3 b& l7 S- j6 Z3 P9 L7 w0 m2 J
ns_marquee.left=marqueewidth+8
+ {: R9 T4 G- k8 ^& e) s! [7 K7 ^}2 y+ S$ D' Q* s( g1 c, D
}
6 t9 l1 U5 M) [' B3 q9 b7 m! S3 P" Q( ?! R' e) j1 q
if (iedom||document.layers){! f; l1 B; k$ z! U
with (document){
, C3 S% ~. z: _* Ldocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')% F5 O/ g0 }4 y, X
if (iedom){7 T. k- s" J$ q& K
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
% W* v! r8 j0 t$ [% [. S* ewrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')1 o/ |+ K; W. [" B
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')" y' I( H6 X0 ?" M9 F" a c
write('</div>')
+ E1 l/ y/ \( P$ j! i}$ v! V3 I. G+ t1 Z( q
else if (document.layers){
B8 y( R. |/ a I- n4 i( ~write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')' r* U- C; A. s5 F7 }: p6 P6 d* E: ~
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')# H5 V7 k S$ l5 @5 N! o; ?! q; L
write('</ilayer>')
5 i, n9 e, C& n l5 R}
5 \ ]* {* K7 p( ^document.write('</td></table>')
& d$ H- W9 ^/ ?* y; ^}5 V& q# Z6 @" e1 Q/ ?9 G; u
}
/ p1 w6 }& Z# z" I9 P% S</script> |
|