返回列表 发帖

网页之跑马灯文字特效

//修改宽度( Y; s8 R: a1 q( k6 T
var marqueewidth=300
+ }" X5 p% R  K2 N) ]) \//高度
( z. h0 v( _% f7 P7 m1 cvar marqueeheight=25$ S% E" S' }. c* j# U
//速度(1-10)% D5 \+ V( n* }; p; i
var marqueespeed=3
  K3 m& }% r1 T$ \/ h//背景颜色
( Y2 G* {/ n# I8 X7 E# e6 ^* Zvar marqueebgcolor="#FFFFFF"; _4 E) n* D4 \6 |
//是否能暂停 (0=no. 1=yes)?7 h2 X2 d2 _. T5 P9 O+ Z! }/ j
var pauseit=1' e* w1 E1 l. P! n& o
( v( f7 \! d: [4 T
//修改显示内容
8 u4 _3 n* L, Z7 \var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
) G- C& R: B4 V  _; D0 H& ?$ L* e5 W( }& e5 [6 `

/ z9 Z$ X  \- y% e" G. h////下面不需改变////////////
1 E; ~$ Y+ }) R" ]; q# L2 u; L# `, \, t: X6 V1 F+ V5 [! j
var copyspeed=marqueespeed9 ]; B8 `4 U" A
var pausespeed=(pauseit==0)? copyspeed: 0
+ R1 U# i; ]6 o+ kvar iedom=document.all||document.getElementById6 g" r1 Z& C; ]0 j! G  |' Z
if (iedom)
/ p8 f( j! q: [, ~document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'); @0 Z4 S/ j0 l/ o/ B1 V
var actualwidth=''
  x% m, z2 N" n+ [3 D& D* Ovar cross_marquee, ns_marquee$ @* I  A  T, b6 f
; U0 S  j4 D9 r7 L$ T0 B% ]! V
function populate(){
/ Y. l. ^0 D/ D! Tif (iedom){
5 {, R; U6 s7 K) c( ucross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee- e0 \' f# P% @( {* K+ @+ p' l
cross_marquee.style.left=marqueewidth+86 l) n4 h/ ^/ p$ [% b' A
cross_marquee.innerHTML=marqueecontent9 o4 q6 q2 S0 W& U! B" }6 w
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
) o) t2 x6 H# N9 j}% D4 T2 y: j7 x1 d
else if (document.layers){
; B$ C7 ]' D! _1 w6 |: K9 A3 zns_marquee=document.ns_marquee.document.ns_marquee2
7 W: J" q% w. q5 U3 x  ?. ~ns_marquee.left=marqueewidth+88 a2 u0 T/ n6 D% \
ns_marquee.document.write(marqueecontent)( u( i& l6 ^$ C- q: o
ns_marquee.document.close()% C. x0 a( m, H$ C1 h# W5 c+ A3 k
actualwidth=ns_marquee.document.width9 k% q8 A3 P* z/ f( q
}
8 `" w3 W- E3 s! Z) _& f4 G9 A: g* ]lefttime=setInterval("scrollmarquee()",20)
/ k+ v/ @: p/ l& n! a- g4 O( C4 A- }# k}; |6 Z' I$ j6 {3 @
window.onload=populate
0 \3 n/ m3 O, X7 C, y7 L: k
2 Q4 M8 Z$ @8 `0 Sfunction scrollmarquee(){" j7 F* }* Z* `* l8 k
if (iedom){
+ N. w4 v) G( Z# t) J8 Kif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))6 u8 g, k) O9 F
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
% P; d1 L5 z2 h7 q( j3 ]1 ~else. y- w$ u  R$ O; q: k! W3 k
cross_marquee.style.left=marqueewidth+8
7 U, }4 q8 x2 `
& x, c* G" u) P: s+ E& O" b}# u6 a+ r0 o# h( o
else if (document.layers){
+ q+ N; }/ g; t! |if (ns_marquee.left>(actualwidth*(-1)+8))$ d. x0 ^( P! T# v( S( D
ns_marquee.left-=copyspeed9 ]6 ]" E: W, ~! u; H7 ^
else8 T" R6 K7 s  Q+ {+ `5 q6 r
ns_marquee.left=marqueewidth+8' b/ Q" F+ x2 A8 z
}
) }% m# g$ W, d& m. F# J}% ?: Y, @2 e" }' @* \3 a

# Y5 V- [, Q+ w7 [if (iedom||document.layers){- ]3 S& }+ L  V4 d. S: o* z
with (document){
) P+ d% q4 `( Z7 b! |) Vdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
: V2 ]# q5 g+ D& t0 Vif (iedom){
7 x' D6 p3 V( L# Iwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')1 W# J7 |+ W. u4 a
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')7 }# y7 y0 {6 Y' _/ m/ o
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
3 x2 Y' Z* X* N" ewrite('</div>')/ c- N: A1 ?0 m5 J3 Z& n5 q
}
* X+ \+ ]1 e6 eelse if (document.layers){
% N" R* n3 o. n: N# _& Q( Mwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')) {% Z$ l. F, Y0 B3 f5 b
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')* E) u" E1 a$ f% S7 W! g7 [
write('</ilayer>')
, }% E7 u0 |3 P( @" y3 r}
" a! m0 b8 c  e; ]4 Q* p9 L- cdocument.write('</td></table>')
" V$ U: I7 a8 g  d, P" f) B5 Q}
4 F* ]% F8 y* w" b3 L3 J$ N: {}
, Z0 H$ _5 d% Q* W+ |! B</script>

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