返回列表 发帖

网页之跑马灯文字特效

//修改宽度
6 I1 `( l( L, A& a3 q5 Dvar marqueewidth=300
6 l" u$ h; x5 t% z- O, z; Q//高度
+ o! c: v/ n, c: e% [( yvar marqueeheight=25; C% O" N  D! q3 f, R- u
//速度(1-10)
/ Z# i2 y7 V, i8 \% b& p! X! X' Uvar marqueespeed=31 f+ ]; P/ z" @+ o  r9 S$ \# `
//背景颜色
4 C" |- ~9 I2 H' avar marqueebgcolor="#FFFFFF"1 J( }+ ^/ x9 f
//是否能暂停 (0=no. 1=yes)?9 s/ `# ]1 Y0 X& p
var pauseit=14 a' ?. b6 I  G) O' u8 o

7 a7 r8 _$ l( b' `! o# u! ~4 \//修改显示内容
" Z: e7 i$ W; Fvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'* x: [' Z0 `( }" k5 ^

$ P4 o) F4 B& _" L+ O
. }' i& S. @3 J$ B! k////下面不需改变////////////
* f; r+ ~$ H) p+ d; J" S" B: L
. i0 G4 k) G' U& }/ C$ ivar copyspeed=marqueespeed
+ {& K0 ~" `' ~0 E2 Pvar pausespeed=(pauseit==0)? copyspeed: 0
: T4 T& T! T) l; E4 g2 [3 mvar iedom=document.all||document.getElementById8 `3 j9 a& `6 F/ w8 n
if (iedom)
# S! T2 S* ?) udocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')7 h/ Q; \, h3 T
var actualwidth=''! p/ T1 b- h5 G  q7 f0 `
var cross_marquee, ns_marquee. E3 ~* _1 q1 I: }8 J
$ @1 _: T! P  M1 i! W+ Z3 J: _
function populate(){9 v# P# s9 U) ]6 L: Z7 [: h# q' [
if (iedom){
- l& J( ?, M; J0 B9 ]cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee* K4 z+ c6 E) g0 N, T
cross_marquee.style.left=marqueewidth+8; |" E, Q0 x8 Q/ C0 Y9 b$ H
cross_marquee.innerHTML=marqueecontent+ h3 v0 p& g0 z' V( w$ g! e
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
5 z0 s0 a: A- E( m: U# _}: l, W2 n' S- t' S" z% N0 L' `8 k
else if (document.layers){
0 x7 N' I4 \2 s" g1 Jns_marquee=document.ns_marquee.document.ns_marquee2
# Q$ U/ r6 P3 G5 Rns_marquee.left=marqueewidth+8" X9 p  {$ ?3 M* T$ q8 V
ns_marquee.document.write(marqueecontent)  P, k8 l" D  f
ns_marquee.document.close()
+ k, c; N2 W9 v! ]1 a& Lactualwidth=ns_marquee.document.width  n( f# _9 f4 @
}
* b- P; m. M7 K; r6 G' z1 ?7 j8 |lefttime=setInterval("scrollmarquee()",20)0 W+ ^( A9 c( {* h% |
}9 Y: t. R/ s/ S1 i6 a- q
window.onload=populate
; C  u9 r* o; r! Y2 P5 ~& F3 ~/ _# V; K0 N  d8 \: G
function scrollmarquee(){% i+ F3 _) N7 p5 ?3 H2 b; e9 {
if (iedom){
8 |, `  \. g& Q3 [# S1 k2 }if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))" U. L: s2 W4 R  g
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed, m. }* b+ K3 _! G9 k
else
4 W) s( H% b$ W' K0 }7 wcross_marquee.style.left=marqueewidth+88 l5 w+ u6 D. q8 m- ^1 Q+ d
0 I& i7 c) A- Q% C, u2 ?- x
}
- v& y$ C# b+ M5 u& delse if (document.layers){
: Q2 M8 B" ^" {2 r( M, a, y$ xif (ns_marquee.left>(actualwidth*(-1)+8)), ^5 ^! X; {, a  @
ns_marquee.left-=copyspeed& t3 ~3 \: O, Z
else
- f2 l% M9 a& g2 Q9 I' Lns_marquee.left=marqueewidth+8- b) j9 y% y! Q0 {- q
}
$ v) H8 z+ s0 [& L0 x8 H}' S! z' d0 w7 v+ V  I

2 H8 ]% |3 B: g3 e8 e- G* F: S9 x/ Hif (iedom||document.layers){
" S7 {( n" @: @& y& `3 L; k/ ~with (document){, Q% H! \0 E& M7 y* M' W
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
) n7 ~2 I, z/ r7 u( gif (iedom){+ N/ P4 V# `2 n1 ^
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')1 M% r* C6 k# G8 [# h
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
3 M3 U8 B  t3 O4 Q! B* o& Zwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
1 A* X, ~' A: d+ h, g2 W& z0 nwrite('</div>')9 k4 ]/ [, }7 W5 [$ j: ^
}; F: O, E/ w6 A9 V% C/ t
else if (document.layers){
9 _# t( F" L* qwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'). q2 W* O9 R4 W; W: ~- t
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
7 v& h* F5 f! s' e# Bwrite('</ilayer>'): w; V! y1 [5 y$ c
}
/ X3 P! O6 [6 ?* k+ W* k! P5 r7 Mdocument.write('</td></table>')
1 n; D0 w; u  @/ t) [# }}
( e! r' a& C% Q1 u3 D6 R}
, H( `4 w$ A: s. w: r0 m</script>

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