返回列表 发帖

网页之跑马灯文字特效

//修改宽度0 D% B8 X# v9 N# w9 Q2 w# Z6 L
var marqueewidth=300
; o( {- `  M$ o//高度
( j: g3 m; |$ d% ?4 evar marqueeheight=25' z( B% l+ V1 `; _$ c
//速度(1-10)
# h0 q1 s  U: D) t, {1 zvar marqueespeed=3
$ ^6 `# i0 |, h//背景颜色
$ N9 H4 L- ~+ s- j8 ~var marqueebgcolor="#FFFFFF"$ d9 W" N) {  _& C
//是否能暂停 (0=no. 1=yes)?& O8 u: w6 n- t
var pauseit=1
/ V! @* ~; b; {6 L) @
  v, O1 p' C: I8 j( {//修改显示内容3 h& C, r+ z4 V9 U+ t* A; S0 ?7 O- b# I
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'+ D( v1 S* _8 o, t
5 S# ^2 p/ k1 I( i/ M, E: }$ \$ b$ S5 f
2 u2 A6 K2 s9 H* [' h- y" \* p
////下面不需改变////////////2 h7 |! c& r, u4 G* b5 Z! i, w% T  L

5 m8 \; l( P! Z" o5 Q7 o1 u9 Y7 b$ Y: ]3 nvar copyspeed=marqueespeed
* Q! Q0 a2 d/ s  }) W, ^+ ovar pausespeed=(pauseit==0)? copyspeed: 0
: C+ a3 w# r! I' t: _0 Y3 W- p. Fvar iedom=document.all||document.getElementById. j! Z2 F4 W" I
if (iedom)* ?6 e/ @4 O7 x  _7 x! G) ~
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')- c2 e  X9 v4 k* I& P
var actualwidth=''& M9 r( k7 Y% {5 }, y
var cross_marquee, ns_marquee! c: S: f3 {" {0 U% Q
* }4 ~8 g9 C9 [
function populate(){
/ w! A3 Z9 R. Z* T& C( A- Zif (iedom){
; M, l5 H, ^9 F3 }7 Dcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
/ x/ o9 q; f# |0 Ocross_marquee.style.left=marqueewidth+8
" R5 @5 P* Z6 d& [' F8 L; Qcross_marquee.innerHTML=marqueecontent% _6 d2 d! Q. p1 M$ o9 T
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
$ ?5 u' J% A6 T; _! B0 H* ]2 O}1 a1 l% R! \$ v2 x; B9 e
else if (document.layers){
. d$ U5 ~: v, H$ U! Y+ Uns_marquee=document.ns_marquee.document.ns_marquee2
' E6 J, G$ w/ J2 ?: c" t1 Rns_marquee.left=marqueewidth+8, s3 f5 m4 a' G; |( ~
ns_marquee.document.write(marqueecontent)
# A6 m; D' ]) E1 a4 W# G- |ns_marquee.document.close()) T3 |$ ?2 A0 G+ L3 W5 L
actualwidth=ns_marquee.document.width
2 u. ]- E" W. }. Q8 w  ?}
; f! w6 ~0 l5 `5 l' C3 U- A& ^lefttime=setInterval("scrollmarquee()",20)
* E) W% c) D& f' t. y& T}+ R$ l' g  n8 N& v
window.onload=populate
+ m( i; b( T: q9 q5 [
, Z7 E+ o. E  k3 E+ j- L& K1 Vfunction scrollmarquee(){# `+ N% y* A3 x. d2 R- N" [
if (iedom){( Y, @8 _) L: o8 `6 ?7 S
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))$ X+ {) L# }9 w, F
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed2 g  j8 j- j) w5 n0 N
else9 e# ]  R0 v0 s. Q
cross_marquee.style.left=marqueewidth+8
, z" g4 p8 S, W+ q; o1 B
( O! U! O4 @/ m}
1 i: i% I5 y2 d' O$ Aelse if (document.layers){" q7 z7 K1 H5 D- [8 X7 n6 h
if (ns_marquee.left>(actualwidth*(-1)+8))
) v7 ]1 f( D' {! \* M7 |/ \ns_marquee.left-=copyspeed
7 E8 V  {# Z0 Xelse+ ^5 F3 _$ M2 S7 E; n. _9 j
ns_marquee.left=marqueewidth+8, R7 y$ v3 P- b, D( f% a6 R, `
}
$ ?& u5 }+ R+ M) g; ~}$ a( Q* M0 o! n
- a, y4 Q' L, ^/ G8 ~. ~* _9 v6 Z
if (iedom||document.layers){: V5 l7 k4 A( \( y2 A! n
with (document){
% |7 M" {/ ~( k, j, j. ydocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')  h) P4 R% S5 r7 l
if (iedom){
4 O  l' |- l; u" {2 E0 `2 Pwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')# D) j( d9 }7 e$ e
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
- q0 n7 R% @6 o; M2 X' Fwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
$ a; X4 C1 A6 I& _( `2 ^3 V% k  `write('</div>')
2 s: `2 @, X: @, L- G4 C" V}' J' G1 L- G$ O& A
else if (document.layers){
6 [+ x4 `( d: @/ X' A6 u. awrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
' O" H# z) B( E5 ~0 twrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')2 [4 R3 j$ U% ^- Y% B
write('</ilayer>')+ F' J0 v0 r" S
}! {/ h4 Z3 f3 [5 s+ r
document.write('</td></table>')
+ X4 n' g  U, ~/ q# ?}
2 _: J) A3 c3 h7 l; I0 _}
+ s4 n4 ~- F5 @  g</script>

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