返回列表 发帖

网页之跑马灯文字特效

//修改宽度
6 R$ |  I0 h6 Y; pvar marqueewidth=300
8 M) G9 A# l& @; }& @- \( q, S$ w//高度
+ B. x2 D4 w$ Y! e+ J+ [) p0 ivar marqueeheight=25
( u7 n8 F" J; K8 k- b6 Z//速度(1-10)
7 L) n" y' s0 o8 [! p& o/ qvar marqueespeed=3+ e: U5 J. A: T/ C  C
//背景颜色% c8 W: C& V) b; l0 c$ |! t1 S, R
var marqueebgcolor="#FFFFFF"
' L# r* ^$ N6 v% P1 ^//是否能暂停 (0=no. 1=yes)?% b7 b( C: X3 p. t9 |/ j
var pauseit=1
8 Z! U3 D" w' ?- v
4 u6 u+ i! g% o2 E! i) `//修改显示内容5 y: ]" J8 X9 _$ t9 i: u
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'" b/ ^" |; i2 O( m! M
9 S6 B# ^4 f  f/ {1 t9 I. n$ P2 C$ U
/ N* u0 V$ v  O) `- w+ L  a
////下面不需改变////////////
- x) X. q6 z! T/ J. U3 i8 O4 z2 {" k3 z; A+ l+ r* b
var copyspeed=marqueespeed
8 H0 ?# i4 k+ o; I# G  bvar pausespeed=(pauseit==0)? copyspeed: 0/ ^+ q. C0 R, p4 @6 P6 I7 M0 Z
var iedom=document.all||document.getElementById( W$ W$ x& a. X9 n8 u
if (iedom)
9 U6 n- b7 J3 H; n% X& W" `+ cdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')) H9 I# l1 x8 e3 g! q) `, `  w& a* R
var actualwidth=''5 p  m: Q# B% t2 X+ e% P; `" z7 h
var cross_marquee, ns_marquee
5 _6 ?0 o# j0 X. f
% y) B- D* r# R/ P3 m. ]% Kfunction populate(){
. O' ~$ ]7 ^0 o, Zif (iedom){
# Y( W$ s, T: x" W( L3 c3 w& Tcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
3 G. D7 ~& f. {cross_marquee.style.left=marqueewidth+88 s# Y# [0 D) l/ X) a
cross_marquee.innerHTML=marqueecontent
8 p" F5 Z1 I) J4 yactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth; Y! N% N% T8 q, X5 o" u" b
}! h: ]# h! d# t; g
else if (document.layers){/ {- E% k% \. j6 Y
ns_marquee=document.ns_marquee.document.ns_marquee2
& \7 c: T1 a! s% d( ins_marquee.left=marqueewidth+8
; M1 [8 j2 ]" ons_marquee.document.write(marqueecontent)
. r# e8 j3 d% yns_marquee.document.close()
) q) o; J$ f  V8 t( ?$ {4 }actualwidth=ns_marquee.document.width8 ^* B/ C! {2 V8 e1 Z
}
+ n6 V9 ?  f8 w7 k2 J7 l7 y4 dlefttime=setInterval("scrollmarquee()",20)" O7 a5 _0 z3 K) ?" f5 j5 N
}1 a( H- H8 p4 C: l8 }4 o( i* z
window.onload=populate0 q6 d9 Z7 ^  B# N' Q
4 `8 ]: z- \2 Z: P. k- }
function scrollmarquee(){
$ W) e  r) t+ P; Zif (iedom){/ t, M" w1 X' _* w! E
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
" \" C$ t, p5 ?3 _6 U5 T" L3 Tcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
5 [) @) R$ K4 t3 y! Nelse
+ \9 \9 L: w" _" Y" j0 c, scross_marquee.style.left=marqueewidth+8
9 b- ]/ o4 \! q* {9 ^
" V" f5 Y2 @; w  ~6 D) U0 M( G. R}" c" A2 `# s8 {% c! N$ @6 \& T
else if (document.layers){- K- p8 n, @* q4 ~( J7 `
if (ns_marquee.left>(actualwidth*(-1)+8))5 u5 H7 s, x2 M( S; C% t
ns_marquee.left-=copyspeed
' y  A2 q$ n  [  Uelse% g) ~+ k0 `5 b) T' T; W4 B
ns_marquee.left=marqueewidth+88 i1 T. I$ G; I9 b% y! v) n
}3 M* S/ `1 G" w6 x- n
}' M1 K# x& ~5 O9 H# b
0 m, \2 k5 N1 G  r$ w, T0 h
if (iedom||document.layers){
# X" p' Q6 I% u2 x1 G! P' Cwith (document){
, h) b; @& {2 @5 f& q0 jdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
2 Z# @5 c  x* ^8 D+ G$ S* Eif (iedom){
" Q* j5 b, T+ L7 swrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
% U) M  ?9 o. ]) b( Nwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
) ?/ ^# f$ A9 bwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
: l2 B- ]' |9 t0 }  |write('</div>')
5 Y& L6 q, R8 k3 R}+ P- m! U; g7 c9 E# A, r- @
else if (document.layers){
7 q6 `9 d3 K4 U) uwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
3 ?8 F0 _! p0 e& ~' D7 {write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
+ h; N. G2 l2 W, b$ W% W( }write('</ilayer>'). i$ @: ~) X( s7 o' l  O% ]
}
5 k1 T9 P3 B, ^2 r4 s! ~2 ~5 Mdocument.write('</td></table>')& j' l* t$ {* P# q5 \- k
}" {& [9 P5 q: R6 Q7 M4 p
}4 C" l3 d& Y; T' {, z3 E
</script>

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