返回列表 发帖

网页之跑马灯文字特效

//修改宽度
; b! g9 F& r; e7 E1 d2 ivar marqueewidth=300! }2 a  |4 l' X
//高度; k: J5 P! r0 U& {% Z
var marqueeheight=250 |( \8 `( N# G5 c3 U
//速度(1-10)# R6 ~5 f( P4 W* h9 n8 Q' i3 f
var marqueespeed=3) }, ]4 `2 D; y3 p3 x! A9 C, u& _
//背景颜色
7 [8 s5 z% E5 qvar marqueebgcolor="#FFFFFF"
$ L: n" b9 N0 ]: B3 L//是否能暂停 (0=no. 1=yes)?
' o+ @3 L4 h0 P. F: E3 pvar pauseit=1' ^+ m6 P& @' O$ ]7 m1 x2 @

( q0 a" W/ L3 F: @: m//修改显示内容: A4 v2 J- Q  r8 C2 q9 U5 G
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
0 z& M7 V& Q8 ]3 V% C8 i3 p" s; m9 B+ s# D, I  x

6 i: |. J% d9 H) U( ?////下面不需改变////////////8 W: ]2 N1 O8 ?& x# S/ v7 l

/ F3 }9 J: z; |9 Cvar copyspeed=marqueespeed* u. L5 n* B5 W. Q
var pausespeed=(pauseit==0)? copyspeed: 0
# P% V5 X0 `4 i# i+ e5 Fvar iedom=document.all||document.getElementById
. H6 f9 P/ z6 a5 E! {* Oif (iedom)
- T* Y4 ]8 t1 |+ qdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')2 ~- i, c- P1 R' H$ {" W# B
var actualwidth=''
6 s2 S7 H* G( ~var cross_marquee, ns_marquee
/ E3 A9 r- j: e0 X! X. c" ]. U7 s* \* z/ b# t) s' N, y
function populate(){
9 k' e) a, F9 R4 \+ H( _& m8 |if (iedom){+ F7 d- I7 _5 W8 g
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
5 F; `4 _& k: \cross_marquee.style.left=marqueewidth+8
# [$ D' I. [3 y: f9 ^cross_marquee.innerHTML=marqueecontent
: W" d/ Y- v2 nactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth3 q/ r" q( A- E2 O$ Y/ L2 K2 |
}5 r) u6 p2 F0 z% l& H! j. v; J
else if (document.layers){
% F  Q: W; \! s) C! r5 j, }ns_marquee=document.ns_marquee.document.ns_marquee25 w' `& x4 X0 S$ f: x, C) E
ns_marquee.left=marqueewidth+8, E; A- X4 W% P
ns_marquee.document.write(marqueecontent)
, p) v5 q9 X" ^% z& W. kns_marquee.document.close()
: D' F, a, M- \' @7 l! I8 Sactualwidth=ns_marquee.document.width
3 W  l/ b  u$ ]}% q2 z2 Y9 }/ j0 J
lefttime=setInterval("scrollmarquee()",20). a; Q! r; F! \7 k% x# R
}
. ]4 w! x8 B, awindow.onload=populate# y( Q9 p0 M4 Q
6 M; h; S" l6 }9 }0 q, x- d! w/ M
function scrollmarquee(){' I: K/ r  o% `! Z/ {
if (iedom){5 y. l! U' y' J! N  x
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)); s# y4 x! j( R0 H* b
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed% K6 c& |. w' I
else
2 _# ^. D" U* c% i# Across_marquee.style.left=marqueewidth+8
9 w/ a9 a* M. Z" H2 Y# g
  @3 a; ^+ x' N}
+ X7 I- |1 V- S0 s  u' ?# Oelse if (document.layers){
3 o  X+ K6 j" b2 nif (ns_marquee.left>(actualwidth*(-1)+8))* {: L' d7 C; M' l) Q
ns_marquee.left-=copyspeed. Z+ Q4 i% a& O1 I# |
else& U* \  n* W) N0 u8 x2 M
ns_marquee.left=marqueewidth+8
1 W& M! M! d: `2 P9 L6 r}
2 ?3 G3 E& \9 i* W  ^2 v9 N}
3 u1 o0 B, j- T5 }6 L) z) G% `) d
+ ^  E) U2 N" U% e+ a" R, u% pif (iedom||document.layers){
9 h+ K2 P6 j) f% L1 p  Uwith (document){
5 n' Y. K, v: ?3 h" Ydocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')- ?2 ^3 K" b' [8 m/ O5 t- Z* O
if (iedom){! }% q# Y* p0 v: x; Q/ P
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
7 {" O+ d, |0 u# \7 M; Hwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
0 l2 y2 v  C' T% M: _# P7 M( U, }write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
; Z( M; [% ^, ~1 e" gwrite('</div>')
3 [- L2 b/ E+ q- ]2 K}
$ I5 D2 Q( Z/ ?else if (document.layers){
( ?1 Y$ K1 j( e/ B! I- Gwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
: A$ [) B; f) Z" P5 Zwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')9 f5 R' j& T7 Z3 q- a
write('</ilayer>')
# Q( R: ?# m, B( z}" w$ y7 Q& E$ b' t& F$ o  p9 v+ n0 l% U
document.write('</td></table>')
$ {& x* M* S6 E- X+ P) q}7 d# i; s+ t# u( `8 i3 W3 u; W" B1 Q$ B
}6 m, h4 F% c: G  I$ B- M- l
</script>

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