返回列表 发帖

网页之跑马灯文字特效

//修改宽度
( ?# u9 L' T9 y( ?% Svar marqueewidth=300
8 R/ _3 `) R. u& l6 g' K  y& S0 _3 {! h" A//高度
" Q& e" J* [' J- C5 Cvar marqueeheight=25
4 r6 a0 Z6 C" r$ H6 l5 D; F//速度(1-10)5 l5 D4 e% [* F- r+ R
var marqueespeed=3
/ g5 N' ]% h. N- g# m& }9 ?2 U//背景颜色
  h) W% D" E; ]1 cvar marqueebgcolor="#FFFFFF"5 u! n6 r4 l3 x0 C9 E5 T
//是否能暂停 (0=no. 1=yes)?, K9 r. t. _% R9 M+ K, a3 V
var pauseit=1. o4 e7 F! t. `& s9 p$ _

* t; z4 J8 e; [- S5 M0 R5 p//修改显示内容: J9 T7 F" R2 Y5 A) S0 X
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
7 ~9 [  B  {. O, |" w" [- X/ F& T4 ~7 p" [4 ~: r! R7 C% ?
+ [6 e  t* y. ^$ p# f0 [
////下面不需改变////////////8 k: g4 `4 H- g5 \+ k( h# w; W* D
: z3 A( F, j& C3 B( I
var copyspeed=marqueespeed
7 @9 }) I! V) D3 r3 Yvar pausespeed=(pauseit==0)? copyspeed: 0
/ k: b7 C1 \( O! Y5 ?var iedom=document.all||document.getElementById9 H6 w+ v- h+ z. ^7 @6 W9 N' u$ T
if (iedom)8 _8 l7 V# Q/ Z. x
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')& N' A8 y( W4 g3 F" D  H
var actualwidth=''% O5 V! r. d8 T) D
var cross_marquee, ns_marquee
6 s, |; y; d1 ?* v- [9 N7 |9 z* }- v6 f8 H& h7 f
function populate(){
5 A+ H+ g9 P8 h0 Lif (iedom){8 @1 u; F2 L0 z) o! j" _
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
6 T6 v8 g: P3 ncross_marquee.style.left=marqueewidth+8# ~' o6 N% E3 a* z5 ~
cross_marquee.innerHTML=marqueecontent, {$ ]6 s1 {7 s& B
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
% p5 b$ q9 p% O) n+ r+ Y* Z& l7 M}
* O+ L! V' d' U% Yelse if (document.layers){
, W$ |/ A# _# w8 n4 Qns_marquee=document.ns_marquee.document.ns_marquee25 l$ H' X4 |- l# w# T- q0 F* z4 ?' r
ns_marquee.left=marqueewidth+8
' u6 e' b9 k- I1 s$ `9 Y3 fns_marquee.document.write(marqueecontent)& ?2 G' m- l& t/ E. `! }  B
ns_marquee.document.close()
% w$ T9 }: q( p8 U$ j* m% t$ ]actualwidth=ns_marquee.document.width
* ^2 p+ \- C9 h0 X- d! U  I}' U9 G" y; \2 X6 c; G' b, Q2 ^
lefttime=setInterval("scrollmarquee()",20)- r" I* ]2 f, h8 z# _
}
$ o& k0 O% A1 l- L: X" bwindow.onload=populate
- |. ^$ \4 M+ x9 F8 M, @
' _' A) N0 U( `& Efunction scrollmarquee(){
/ U, d5 q, i4 z! Z  I+ L+ ~8 z: l+ bif (iedom){  u) q* c  E4 ]8 {3 G
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
" A/ |) t, ^1 T. c0 `' r7 z( Ocross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed- Y, u, ^- B3 h- a# m$ a
else
& E: l$ d& o4 l2 S1 U- ?cross_marquee.style.left=marqueewidth+8
. N' i2 |. A- E/ R" k+ L/ t1 p/ S& x* L( H5 v7 G2 t! S) E+ S
}
# q+ c7 S+ N3 u$ P: ?" }! B" celse if (document.layers){( k9 S/ c; d7 C- Z* M% @6 }
if (ns_marquee.left>(actualwidth*(-1)+8)); D) p/ ?" q0 B6 E6 |4 r8 V
ns_marquee.left-=copyspeed/ Y9 i; d# f. B! ^9 h
else3 u: J$ ^# X! n' j( a* X
ns_marquee.left=marqueewidth+8
1 R5 r! L9 X5 j9 X}% H: {1 v2 ?: l5 R. }
}
$ ]. m4 G2 t, e% Q" ^% x+ A) _5 ^" Y
( ~. a0 u3 l" T0 G- d8 j& dif (iedom||document.layers){; C' I& W( k9 [* [) |6 p
with (document){
; X$ f7 ]4 i4 f9 `: D' Ndocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
9 \) L( a4 [; }7 hif (iedom){
. U0 U( ^0 y7 @9 |0 _- Cwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
& i/ |  [4 U# }9 W, T+ H: gwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')* ~( q0 t. i6 I3 \7 D! H
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'). I' j8 p( ?% q+ m" m
write('</div>')4 j1 f/ v$ W' m* }$ s0 m% v  v% R
}+ U$ t: K7 W0 O; R' G, ~
else if (document.layers){! ~  _. B9 D/ V( n0 D# Y7 N* j
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
9 u+ R7 j" Y. E4 h) Awrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
* t  ^7 }2 a% Z5 \$ k; T" zwrite('</ilayer>')* Y/ |$ N  B! D& i5 H- R
}
" H2 m- [$ s6 x, `document.write('</td></table>')1 q' q2 I# P. V; C2 n. o3 D
}) G4 {- _' e8 q) }5 g
}/ J& _9 q0 A& b; t# D4 t' [
</script>

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