返回列表 发帖

网页之跑马灯文字特效

//修改宽度* \' d2 [2 D. u
var marqueewidth=300- h: p8 J5 h$ e0 Z' s
//高度) f8 ^+ l$ ?% c- u( I  G8 V
var marqueeheight=25: y6 Q* |, z) f6 F+ H+ ]1 E2 h
//速度(1-10)/ f# x, w8 Q$ D. Z
var marqueespeed=3: V' b7 F" u: T% A9 r% I
//背景颜色  Y  P2 S+ c" f; c" p: y( P/ m: {
var marqueebgcolor="#FFFFFF"; g- {) k, [; D7 q5 V
//是否能暂停 (0=no. 1=yes)?* m' T$ P1 G7 V9 G$ `4 F1 z! b
var pauseit=1% F" B0 F: K2 ?
% ~9 c* p% \/ x9 V4 A& X4 m
//修改显示内容
) t1 r8 j! [( ]4 D& K" Dvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'. F9 ~7 F; P2 k
& [" e& `3 b$ m) ~$ I5 y$ v9 l
. H# Q( _8 V' \0 {9 ^4 I
////下面不需改变////////////( V6 _+ E$ G) ?& r- `
: E* o3 o9 p6 n
var copyspeed=marqueespeed& F2 s, d5 s1 Z! d1 y2 _9 H
var pausespeed=(pauseit==0)? copyspeed: 0( |- y. R$ B5 ?6 t
var iedom=document.all||document.getElementById* J* G: O: `* H" D- i: i% M
if (iedom)/ P7 L5 D# ?' p- q
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')  w  [& h' g5 r8 d9 S. k) B0 `
var actualwidth=''9 n3 \# C4 b6 @
var cross_marquee, ns_marquee
9 ^' _" E5 `" h8 B' ~5 K; Y0 @6 c7 D+ c- o0 U$ \) i
function populate(){5 t/ ?+ k, \; B7 q
if (iedom){
+ \2 N# ]7 C: xcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
' a9 f' d4 K) G2 s3 ycross_marquee.style.left=marqueewidth+8
. F4 L/ ]+ o  @, J& J+ ]4 Jcross_marquee.innerHTML=marqueecontent
, I! T. Z: m5 ^9 t7 ractualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth- o! C( J: I% w0 q
}' O3 ^( Y' ]- g8 z' b
else if (document.layers){+ F( f0 V" d2 s: w4 P
ns_marquee=document.ns_marquee.document.ns_marquee2. `0 V. x; |* t, v0 J" }
ns_marquee.left=marqueewidth+8. K" u; G- g# P" d: [
ns_marquee.document.write(marqueecontent)& I8 g  Q* s% x1 I9 A. \
ns_marquee.document.close()
" ?" f# b$ y; W6 U8 bactualwidth=ns_marquee.document.width' f$ E) X. u/ e5 T6 }
}
. b+ K1 x5 X7 ?8 |lefttime=setInterval("scrollmarquee()",20)
* L# @1 z# l7 w) C) [$ O1 t}
: j8 H/ b3 Y! c4 F6 `8 |7 wwindow.onload=populate7 `8 J" W! ]' m- m. m4 @- P' \
2 s& J0 x4 v0 ^0 A; O5 Q, @: h
function scrollmarquee(){- P* A+ m3 [+ V, @
if (iedom){
3 G; t8 f. d" {if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
& K  k* J& [  i7 dcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed) t% a/ `8 y9 k- c3 |
else
: g) _, R7 ^3 m4 w* ~5 bcross_marquee.style.left=marqueewidth+8, l8 I7 J6 r+ ]; y; Q- B/ H

* B5 R* p, w% w( \& k; W}
1 x1 R1 }2 c' l% Ielse if (document.layers){
( _0 Y% A6 s* O* G  ~* A: Q+ Nif (ns_marquee.left>(actualwidth*(-1)+8))0 F+ s( L! m8 d3 z6 q4 q" n/ x7 q
ns_marquee.left-=copyspeed
% m4 a% Z, Z7 ]# V$ Belse6 x, @5 h$ ]# A6 v8 h
ns_marquee.left=marqueewidth+8
" n3 ~  B8 F" ~$ j* X}7 X8 q& t) {" o, H
}) a6 H$ T. O/ T1 X- D6 F

9 I4 M/ [2 C8 u1 z8 e9 K  gif (iedom||document.layers){
; x/ H; H8 s. d% c. T5 f& z* awith (document){4 I1 \) ?& v5 Q( B( V) R: S
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
; ?4 g5 k( B4 }3 J2 Eif (iedom){
; n' g6 W* K; L$ b8 _+ x$ A) Qwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
3 M4 y# _) S- l. S  z% L, v2 {. lwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
7 @6 t3 B; D2 q+ j2 n0 l5 swrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')9 z4 N5 d- S. m. S
write('</div>')2 C; |0 ^/ q! W1 `$ k6 {4 b8 f9 B
}- [  y9 g4 a. Q! Z1 A
else if (document.layers){
5 G! {) ^9 i# jwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'). p3 {) Y1 u; T, L  Q( C6 r, h
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'), |- U2 F1 S  U5 X" c. J+ O
write('</ilayer>')0 R, M# R6 y$ i% B0 D9 {6 H
}
# F/ Z8 Y. u* x* Q: u/ Xdocument.write('</td></table>')
% X! v0 q: k. D  o9 E}& M5 v7 m, \, g- v
}) c1 j& j' [4 J  F) k+ E! f
</script>

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