返回列表 发帖

网页之跑马灯文字特效

//修改宽度. ^& {0 w; r0 \7 x! l+ k3 z
var marqueewidth=300
" y# c' B' X2 U" T+ v. |//高度& g* [6 o! B8 W; F
var marqueeheight=25
& B  ?& Z* d; P0 f0 w//速度(1-10)5 b$ y8 Q5 s+ m
var marqueespeed=3
( T8 r( O/ f" g% n//背景颜色
2 i  x. V4 R1 g" Uvar marqueebgcolor="#FFFFFF"8 X3 h" y6 _3 C9 E0 e) }
//是否能暂停 (0=no. 1=yes)?
; w9 Y" u7 t" [! J8 mvar pauseit=1% G& G- Y5 n0 w& L

1 U, I% Y: o  _+ e4 e//修改显示内容
: d& Q& s; C9 i3 f& Y; h+ lvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'- r/ \9 A+ M2 Y; ~1 z' p5 o
, n9 r4 b. }8 z: K% m! N: u; ^

- ?9 x" m+ y/ z) l////下面不需改变////////////
8 r7 a" I) g/ C# _. S' H0 ?* Y* C0 Z# s
var copyspeed=marqueespeed# R' V# B1 S. v8 q1 E. }
var pausespeed=(pauseit==0)? copyspeed: 01 N( N+ f+ F0 ~6 [
var iedom=document.all||document.getElementById: `$ q0 n/ ]5 |/ g0 A1 g; @' C
if (iedom)8 i9 d) D1 Y/ D8 x6 c2 t$ W- U
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
! [( p; W! U8 v; X9 kvar actualwidth=''. `8 E8 J$ S7 e6 U  M
var cross_marquee, ns_marquee& x5 ]% M0 X/ N! n

2 l+ h! Z2 Y. `2 \# y1 w2 {function populate(){" a5 W/ e7 w5 H9 w! q. d* X3 }5 w
if (iedom){
: v$ b9 u! \/ Y. p/ I/ f6 n0 Kcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee7 [% z2 i" O! R4 Q. K9 {+ T/ E
cross_marquee.style.left=marqueewidth+8; _0 y, q: {( Q. s% h$ F2 X3 T
cross_marquee.innerHTML=marqueecontent5 a4 V# W' |/ i3 k5 c( D3 R9 }( q
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
+ S3 A: e- s* d' y0 c5 V# l}8 |/ E6 P# c" d4 v
else if (document.layers){
* Y* k9 @5 u* }6 B) o& H1 ?6 ^, wns_marquee=document.ns_marquee.document.ns_marquee2
# U/ s5 O" X' B0 k4 _7 U, Sns_marquee.left=marqueewidth+88 \! a# d; ~& A/ N, J3 u- U# z
ns_marquee.document.write(marqueecontent)6 k* ?& V# L/ T0 a
ns_marquee.document.close()
$ P; @2 q0 K, F# K8 nactualwidth=ns_marquee.document.width
0 c; N& W) q9 U4 N9 a/ \0 |' J}9 O6 a9 E' N% U) L
lefttime=setInterval("scrollmarquee()",20)3 Q5 I3 z. D8 ^( q4 [
}( Q+ F- @5 D5 i+ c0 l
window.onload=populate5 f. N( i9 v/ l, q8 m. |
3 w5 g2 ~6 H/ Z1 Q* z; L) d) a( B( k
function scrollmarquee(){
/ }% a. C/ K! x- vif (iedom){
% w3 n5 n. k/ |; }if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))& o( F$ U. m5 u# U" ^
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
- J% o8 m) |% X; w1 Kelse  ]" f& x) p/ a$ i; m# z/ S% P
cross_marquee.style.left=marqueewidth+8
7 |' C1 q$ R: Z$ m2 j
# Q; _6 m  _& ^4 g}
6 ]/ I  U4 u+ F) R; l4 q! `$ ~else if (document.layers){
- \7 o8 q& B% ^* G7 {if (ns_marquee.left>(actualwidth*(-1)+8))0 w+ A2 ^7 G* z4 b
ns_marquee.left-=copyspeed5 I; J+ R  N" Y3 i
else7 M: f, c- i+ V
ns_marquee.left=marqueewidth+8
( Z. O; I. C, R; c}
) G. {+ v9 t" F, ]" B# M: P! u}. R4 q8 G! b; B/ n  R3 A
! [% V2 `! F" m) [; C. q
if (iedom||document.layers){
" W7 h% f, c) zwith (document){
2 c) Z% F) N$ R$ \0 T9 `$ ^document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
; y7 @* J; @3 k' R) Jif (iedom){# k, J2 p/ T: k
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
4 K8 `( J& g0 E- n+ m# p1 V/ awrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
4 J+ T: D9 Y  }; q* f* C/ Jwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'). l" c& j4 B4 U1 V- d2 E) Q: y
write('</div>')
. Q6 R& o- C) J" M}
, i+ j1 J) I; C6 |+ |4 [& B2 B& a9 Jelse if (document.layers){
, W) }7 D1 }- G2 c3 ~) _write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')( W9 ?4 D; j7 w) ?
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')* Z8 @* U' k' m  t
write('</ilayer>')
% f2 B" m. }5 ]9 i9 o- r}
# x" x. p' \4 X2 J! `1 e. ~document.write('</td></table>')  U, q" w# v' q5 v4 r2 d6 r% A
}
9 f  E! [0 a' A$ [, C}
; \+ Q; @% t2 M, P& g</script>

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