返回列表 发帖

网页之跑马灯文字特效

//修改宽度9 i6 J7 [3 n5 {. Y8 S- r' m  [
var marqueewidth=300/ v" [# Z0 }) i
//高度
) s/ F$ k9 p' S  Lvar marqueeheight=25
4 z8 \! |% {. t0 \4 F& T//速度(1-10)& q# W& C9 x9 L6 t9 I: d; I
var marqueespeed=3$ P) I5 W% t+ S$ B. [  ?
//背景颜色
! n0 f/ r3 D8 r' S5 l! Qvar marqueebgcolor="#FFFFFF"+ M- T% j0 q3 w" R" R
//是否能暂停 (0=no. 1=yes)?
5 g. k6 L, U. L$ Nvar pauseit=1
- y+ W; ?7 q5 Q+ M, j$ C  H2 X
7 i/ w* W' r  O# k! `//修改显示内容4 y+ I4 k/ ]7 p" g" S$ E" ~3 y
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
+ ~' |. v7 k* s  M+ N1 V! J) |8 l# |5 C1 `

3 e' T& m: D" [. v# d% w////下面不需改变////////////" `! Y3 i/ }- c- E4 |4 v2 ?
% [# L) a: A6 C% @# M+ q
var copyspeed=marqueespeed$ e/ E% N, W& B! C# G2 Y% Q
var pausespeed=(pauseit==0)? copyspeed: 0( o4 f0 `7 ?3 Z- C' `' j8 X
var iedom=document.all||document.getElementById6 m. g( O! x4 p4 B: S: H+ s
if (iedom)1 ^% X0 W# R- k" J) h( ^
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')' s- ^' w7 r' C) ]. c2 r4 }
var actualwidth=''
. F8 _* a0 G3 Y! |4 Kvar cross_marquee, ns_marquee
, i% r/ T0 @" ^* S
( J  m$ y2 M& A4 Lfunction populate(){
1 e( q( e, C. R' xif (iedom){
. J+ x  ]/ `8 ^2 M$ J$ Hcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
5 s( `% s( l# p/ W, x& Ycross_marquee.style.left=marqueewidth+8
) L6 f; k: i9 a1 x: ?" scross_marquee.innerHTML=marqueecontent. D# R' g+ w' g$ _% k2 k4 H' c
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
+ h+ W# @) _0 @0 f}0 \/ y8 x. U, P9 [
else if (document.layers){
& E  W0 q  J" F4 r! L0 Ans_marquee=document.ns_marquee.document.ns_marquee2
* o* c/ T- s- jns_marquee.left=marqueewidth+89 u$ W- j$ \) }* y, N+ \
ns_marquee.document.write(marqueecontent)
! P* x6 ~( f! P% T+ g# ]$ ^" Hns_marquee.document.close()
# \5 u' w- J9 A) K: Hactualwidth=ns_marquee.document.width
  O; j  b( z9 ]+ G8 K6 A6 F}
4 j% ]" S! j* tlefttime=setInterval("scrollmarquee()",20)
7 |+ g' v7 I: l& q  J) ^% Q}! i. [( x$ g' h  V/ H
window.onload=populate8 [; R% t! g# N" w$ j  j

. I! v, E$ I0 d! Z' ~* O' H+ U3 s, Ffunction scrollmarquee(){2 ?$ k4 X/ P. G, R
if (iedom){
# p7 D- N2 |9 xif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
' }* Q2 f  E6 h# z* R* qcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
. D5 c6 c9 V$ F$ helse( B- o6 X2 L' j8 k; h
cross_marquee.style.left=marqueewidth+8
" b- m9 b$ U4 w
9 a; t# O% w4 z# g0 p) @}
; L7 Z+ H5 U3 _1 f4 Y  Q. belse if (document.layers){8 Q: w/ E; p1 E6 I( n9 n
if (ns_marquee.left>(actualwidth*(-1)+8))" Q& ~' }+ f0 X+ E* N
ns_marquee.left-=copyspeed, w0 g1 T- N% U3 m* A4 ]
else
6 D( t: |* ~( k8 Y) {7 Sns_marquee.left=marqueewidth+82 c, n: i$ D/ g9 I8 J. c
}
" r6 {4 y' y6 n4 }/ U& n8 F}7 p3 w" \4 D: Y1 I3 b

/ i% h# v( O% v1 p4 v2 K1 y' C6 fif (iedom||document.layers){
6 z2 A  ^2 z& a7 x8 x" Twith (document){
4 q; Z; L4 I2 @1 ydocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')5 M+ k5 ~5 H' h8 q6 c$ @: n% r
if (iedom){
( d( k& C4 k& |" g0 j! bwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')8 X# l- }9 R# |; f+ s
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
2 X' F' z3 p' ]% _- m7 Ywrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
0 S) B2 c8 k- o& ?5 M+ r* U  [& {* bwrite('</div>')
1 L2 r# [' ]6 B2 `4 }* p}3 Y  c4 S: g2 e+ ]
else if (document.layers){$ F/ {, j0 X1 I% t+ |
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
. n& g; x1 ?# W7 r" Qwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
) K6 Q& @! O/ E' d$ r# n) e) K4 o0 x' Uwrite('</ilayer>')2 O0 m0 x  [& Z. V
}( y1 H5 w0 u, b( {2 n
document.write('</td></table>')0 u4 }+ r; c7 d4 I" n# @
}
3 {0 P% ^6 r, y: X+ h}
' z7 Q- n- |$ q( ^0 v$ V</script>

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