返回列表 发帖

网页之跑马灯文字特效

//修改宽度
4 \( H) P: L6 A# q0 m/ d6 L7 z0 Gvar marqueewidth=300
7 N! c# _7 s" H/ L& C//高度( I0 u9 q+ q/ [- g- y
var marqueeheight=25: y$ ?  \" P' j; E! ^% B$ I
//速度(1-10)
, L2 v6 m; M7 r# J  x% Rvar marqueespeed=3& l; Z) Q; A0 y8 C; j
//背景颜色1 f& g+ _) U* l0 T% }. {2 M
var marqueebgcolor="#FFFFFF"
& f% y7 L; a1 f9 D) F( P& i1 T//是否能暂停 (0=no. 1=yes)?
+ i: P- f4 {+ D& ]; T0 Wvar pauseit=1
0 W1 K  @, G+ d2 W  @+ Z6 r7 k1 Q1 u( {) W$ c% J
//修改显示内容( X$ G+ ^! s  [  s6 \- {4 V9 ^
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'/ A& z% d7 l& S0 W# X
) Y0 d/ L* C4 w3 h

% p8 t8 @9 q0 X6 l////下面不需改变////////////
3 T; r! \6 {# y
: o9 E' j. C9 z# Dvar copyspeed=marqueespeed
, P/ N% l5 x! V5 Mvar pausespeed=(pauseit==0)? copyspeed: 0
3 j- \% ?; P. m5 }1 fvar iedom=document.all||document.getElementById3 S/ k* E& Y; I
if (iedom)$ ?# U; C  L* k, n
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
7 x, q% [. z1 V* d0 Z; Hvar actualwidth=''0 }4 P! Y( H, @% L; r, y" S
var cross_marquee, ns_marquee
5 S7 P. F2 _0 v( B9 L/ X" K/ [, o; W0 V. }
function populate(){
4 M' y- a+ _2 Z+ d, m7 Xif (iedom){
- x/ w* \! X6 @& A1 Q/ gcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee; _4 I" \, L3 K" N  T/ Y
cross_marquee.style.left=marqueewidth+8
$ [% i9 J9 G- N! mcross_marquee.innerHTML=marqueecontent
/ J) f4 W& X  ~actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth( e- I8 W; |& T- ~! B7 V
}
2 l' m0 E. ]* Y+ S1 Y( Qelse if (document.layers){) V* |3 j8 z2 v+ V! r6 D
ns_marquee=document.ns_marquee.document.ns_marquee27 U' j0 J" X, N8 J( W
ns_marquee.left=marqueewidth+8. h8 r; v' j. K5 S1 ^+ X
ns_marquee.document.write(marqueecontent)" c; Q6 M. o: N4 Z7 _, ^4 R
ns_marquee.document.close()( t1 \! B( q' }' N9 N; o! `
actualwidth=ns_marquee.document.width9 A9 N" n/ b5 g6 @7 Z- }5 ~
}
& Y( [& ~" [: [7 d& h: ?  w2 flefttime=setInterval("scrollmarquee()",20)
, N$ c( {% f8 p+ h: A}. G* O4 O" m7 I1 z) t4 F( N  Q
window.onload=populate
8 o/ A8 o+ C  q8 B
! Y  j- A7 |1 p0 B4 e3 t5 Bfunction scrollmarquee(){
( r8 N; [+ R  L2 {. z* m6 X" Bif (iedom){6 g0 {& G$ q' `1 ]$ Q7 V6 f
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))/ B! [" b: N( P  o2 c
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed8 H! v+ Q1 r" z
else% L( q+ L" `! f& K+ C2 L! l
cross_marquee.style.left=marqueewidth+8
. I% v) \# @2 h+ w1 A: @; _& j9 Q
}
' z( G$ J. [1 }+ k; Melse if (document.layers){- f& S3 R" g- x9 P& m- P
if (ns_marquee.left>(actualwidth*(-1)+8))- ~9 R+ ?2 p3 q( X
ns_marquee.left-=copyspeed
; l$ J, W. }$ \, R* Z2 p# celse
/ p9 R8 x; E/ _ns_marquee.left=marqueewidth+8
3 x/ T# b5 t$ [4 l}
2 H. P% v3 E" Z3 y}# |0 ~5 X! `3 f5 A. [; _" F, g# ?  S

; s- F* D/ I$ [3 oif (iedom||document.layers){
8 D% K! f, {( L5 R& hwith (document){* k4 S4 z2 n8 u+ ]' v3 G; E
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
2 z$ A8 n5 k% M- Z) i/ G/ @if (iedom){9 K4 b$ m* }$ q% m) ?( i% ?/ _
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
( ^. u6 L7 I* ]write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')! N/ G3 ~9 K! E3 a3 d
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')0 J4 N* ~( ?9 w5 V/ A5 b' z  {
write('</div>')
% E- p" [' d+ P" E" |}
: x, z. I/ d5 |1 Nelse if (document.layers){
% b3 L; H% l/ y, @/ K+ ?* ywrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
8 u0 }, i5 m& T- P5 r! ywrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
* C" m9 q' o8 P* c: ~( h, fwrite('</ilayer>')
* E6 i& z1 t$ W  r1 Z9 }}
' z2 y% f. M" [8 W: Q. k* Ndocument.write('</td></table>')) _" f1 v" d; b" s5 f; d
}7 Z& U: ~9 x6 F! N# ^# W
}
/ t& [1 [0 C' Z5 F' ~</script>

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