返回列表 发帖

网页之跑马灯文字特效

//修改宽度+ }, i9 O( M* Q0 G& Q! ]
var marqueewidth=300
7 e5 Y& [* c/ {' L//高度
2 B' x, u( G3 `4 G! \var marqueeheight=25
- @9 d. r  v% U  w2 S//速度(1-10), f) m4 F9 C. E
var marqueespeed=3
7 s' k3 X. j: k9 K; e//背景颜色
, J( o$ ]5 v2 |. kvar marqueebgcolor="#FFFFFF"
3 y& t- m" W' ~# {5 L//是否能暂停 (0=no. 1=yes)?
/ ^/ t- ], B* ~2 p* Lvar pauseit=1
2 |+ ^0 H( m6 I( v( ]7 [0 e; {8 U8 F3 a& h
//修改显示内容, N! u. Y7 I; F. {& `# O
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'' S# X0 h( q; W; M
) R9 x  m! C1 B; B9 R" \

% g: a5 h! u( o0 a# A: V( h////下面不需改变////////////
) ~; g! o) t! |$ L5 M; [& q4 I0 U- Z5 R3 k
var copyspeed=marqueespeed& ?( E4 |' A7 K2 ^
var pausespeed=(pauseit==0)? copyspeed: 03 s' H; x0 b2 O' u
var iedom=document.all||document.getElementById
& j$ @5 e2 C. L  |, A- I8 Aif (iedom)
0 `! ~! V! D8 n: K8 B, u5 k: Zdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
: }, ]: |  A- ?: F" y; M% {) wvar actualwidth='') V" R2 {, E# L
var cross_marquee, ns_marquee
  v) D, \7 F$ U4 v- [
1 a; n+ S" E3 u. Ofunction populate(){
8 O6 m  H+ u- t; i( L, cif (iedom){
  v% A2 O6 |+ j5 N, `$ Ycross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee. S8 r# i$ r. f% a: @) {! s8 S, D: I
cross_marquee.style.left=marqueewidth+8
  |! Q/ t- v+ L' _+ zcross_marquee.innerHTML=marqueecontent
" L/ e. K, g) B! z) Gactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
0 N3 T/ Z/ U4 t; j7 |6 L* @}9 n# Y' s$ v5 l# |
else if (document.layers){
' x: ~8 @% W$ v0 c0 v. O3 g9 Lns_marquee=document.ns_marquee.document.ns_marquee2
6 l3 J5 `  I( [0 J: e! uns_marquee.left=marqueewidth+83 _  I) N4 Y* ]* R4 @( H
ns_marquee.document.write(marqueecontent)% k2 w# H$ @0 e+ L" b" D; ^
ns_marquee.document.close()2 R( j. s% K% C1 n+ H$ D' {
actualwidth=ns_marquee.document.width
4 C& V/ s5 c- M# g2 E3 R* {6 x}
$ g5 ^5 r- n3 h) k; T5 ylefttime=setInterval("scrollmarquee()",20): j" C: h/ h0 l% @+ c0 j
}5 x5 \  O7 p0 m( s. {" J, S
window.onload=populate+ a2 ~4 a  M2 T9 i# K2 Q& }  _2 _7 a

2 a; x" i& b8 b9 `9 ]1 x' Cfunction scrollmarquee(){) i. k2 f4 s( a' T0 i1 l
if (iedom){
5 o: L% e0 [( ?, U! C; yif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
; T9 e, M; X* N7 K7 x3 Z1 scross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed7 w! p% C6 }2 j' C" D0 z6 x' R
else0 B3 {( c3 j$ ^( P  m5 N
cross_marquee.style.left=marqueewidth+8$ q; k" c, G1 i  G

% Y  W. h3 J3 d}3 Y* K! u& k( y+ p  h" J5 O: v
else if (document.layers){
6 j1 t' P& u. k2 w  F- Zif (ns_marquee.left>(actualwidth*(-1)+8))
: h4 r3 X3 @$ {2 ]' Fns_marquee.left-=copyspeed
# V2 s! R# M- L/ r" X# \0 G7 Lelse
, `: q' H: c! s& J8 @ns_marquee.left=marqueewidth+8' M( T6 N0 N, @& n8 t
}
: h9 m, i) H; h% p2 H}0 T8 o' w7 `8 F  ]* r
  T1 `- O- z* v, b2 O
if (iedom||document.layers){5 [( ]' u* u9 J' q
with (document){: t6 u, s) m; B/ ^# N" G8 }
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>'): N0 U+ ^- H  A5 p- D6 j0 ~) T
if (iedom){5 f* x' u, ^( A1 K
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')5 m" e% ]" H/ x
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
7 b: f7 g- t: o6 {; C# N9 Zwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')$ r0 G$ ]" Z* @- k" U: K+ Y2 w
write('</div>')
5 `+ d5 S; h1 K# v% x" r- |; `}2 U5 S) I+ C4 F, j# L  E
else if (document.layers){
4 x% J8 b. S1 ~8 h) @% x: P! mwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')' C, g: r# r# g% D3 |% P6 J  O
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
2 C# K) B5 V: f: |9 f* ^: N2 V) `+ }" Q6 {write('</ilayer>')% o# U' g  Q6 o9 x0 o- A
}
$ ^- M6 Y) ~+ q  H+ c0 i5 |1 Q2 Bdocument.write('</td></table>')
# t. k" g( R) f( g; a}
2 o) [+ G% ~, t2 ?+ l# X% s8 z1 Q}. K* ~4 ]' [; H* n
</script>

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