|
  
- UID
- 133
- 帖子
- 51
- 精华
- 1
- 积分
- 186
- 金币
- 55
- 威望
- 2
- 贡献
- 0

|
网页之跑马灯文字特效
//修改宽度: s! A6 R$ R: V7 U D% b$ Y
var marqueewidth=300. {+ _+ R; q# K" B! F0 h' i
//高度
6 y; @7 |0 p3 h! F7 ]8 \3 _var marqueeheight=25
. y' S9 ^7 Q6 i" A0 @. Y3 q//速度(1-10)
, }; u0 }1 a9 }4 ?) y# Uvar marqueespeed=3
' ]. X* X3 S5 c/ |% j$ }+ b" k//背景颜色; \. C( }* V. a) [: e# j
var marqueebgcolor="#FFFFFF"
5 z* a o; T! A4 y1 N5 g- o) E5 I//是否能暂停 (0=no. 1=yes)?
8 H; h4 v: h: d, p) I8 K. Wvar pauseit=11 H# S6 K+ v3 g% X( E3 L! T
6 \" a& s1 D. n) A) j2 j% W//修改显示内容
2 x5 I1 a7 Z5 zvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
! M c1 P* u# w: q- ]2 U, Z5 B }1 e, `/ o* ~* \6 `1 G
7 S" q2 `9 R* j, s( f- F% ], c
////下面不需改变////////////
/ l) P% D& L$ p6 Q: R
; ?9 U! k; N$ |var copyspeed=marqueespeed
6 q3 Q8 B/ P6 [% B, p; Pvar pausespeed=(pauseit==0)? copyspeed: 0+ m" W9 X l _
var iedom=document.all||document.getElementById/ ?" O+ p. a! h2 Y, _( W, z, j
if (iedom)
1 I" I* e1 q3 k7 Z; Z9 N- B- Zdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'). e+ E8 q% [4 Y7 q& d) N0 S# W4 y
var actualwidth=''
; V% R, N$ _; \. B6 t& hvar cross_marquee, ns_marquee# i/ e9 B( R" w/ l7 \9 r: i0 i- s
( G7 `" ?' g4 E; {4 d! g
function populate(){
) f5 F5 \* ~1 N' U9 I2 s6 Nif (iedom){- ^+ S H8 C1 d7 Q( a
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee( V. U" |4 F: D3 H) P; x, U; w* @
cross_marquee.style.left=marqueewidth+85 u$ w3 Z& [! t5 a# {. Y
cross_marquee.innerHTML=marqueecontent; E9 f+ ?2 q' y4 N8 y% x, N
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
; n4 c4 R; j% O$ N: C* O}( e. l$ x0 | I3 ]1 t' T
else if (document.layers){
0 ?' D. t8 V8 b+ V- ins_marquee=document.ns_marquee.document.ns_marquee2
+ d0 p) @7 h- g: B N& w( xns_marquee.left=marqueewidth+8
# e4 g/ I0 [6 hns_marquee.document.write(marqueecontent)% u; Z" A4 y/ Z4 l; K# `5 I( [
ns_marquee.document.close()
& O6 P' m' H! b, n3 q& bactualwidth=ns_marquee.document.width$ `2 x' \2 T. i* f
}
3 A, q2 o/ {6 l; ^( \ Y0 ilefttime=setInterval("scrollmarquee()",20)
9 _) J5 V3 }0 T% @2 Q, } H" N}/ l) @" R& Y0 ~; c! W: h$ ?
window.onload=populate
5 O, T8 c' S9 B8 n, H6 _9 }8 O& e- f
function scrollmarquee(){0 r Z# j' ?- L4 ?. c
if (iedom){
) Q+ Z" f$ n# _if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
+ w( d+ x/ J3 p' f+ K& H' s0 Fcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
' n, N9 C8 k/ \$ l: uelse
" g2 s+ k( H2 O4 h% X: c2 w' bcross_marquee.style.left=marqueewidth+8
7 x2 O- Z# P% T2 t/ ^* _9 d( k$ H: Y
}+ ]1 D- h: L. o/ i3 q0 T8 O# W3 {
else if (document.layers){
6 [% m( d, O! p, zif (ns_marquee.left>(actualwidth*(-1)+8))
+ U# v/ ^! s! Ons_marquee.left-=copyspeed, y0 U9 Y5 p: O5 ?3 |4 N6 I
else- V4 M" f+ K7 P* Q. e) O
ns_marquee.left=marqueewidth+83 t4 h8 ^5 D7 U! t0 W
}7 I6 X$ _: c9 d, t; t, i
}; T4 B, E+ V7 Y! G% N* {" g% D
- u- v9 o& e. t) d$ M
if (iedom||document.layers){
! o7 _3 ]5 W$ }6 c6 ^( Kwith (document){7 m' L9 ?; |/ u2 E1 x6 i
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')2 Q |9 p+ r1 N# @( z c! e! T5 Z
if (iedom){
: j a) n/ ]! b1 x- w; H" Y; Nwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')6 z% \$ ~& J2 t" M5 ?
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')* r: n& M+ B8 d# O$ ?0 r/ r
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
/ A, E3 }& l; Z' q0 ^% F3 A9 ~write('</div>')
5 F @% B. ]$ x- g, t; K}
% p9 a. ?7 q5 Aelse if (document.layers){ r! N$ B7 n: V7 a) l) }
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>') U4 t" W7 @" _
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')% z6 r: K* E) d* d, g; P: F4 r
write('</ilayer>')
% z8 {$ Q4 y2 Y: ]9 w- R4 x. ]}8 W' s' l, d8 e
document.write('</td></table>'), A0 Z% U( y, ]% b* }4 x- o
}9 a3 [% f, \; u3 f, I7 _/ ?7 \
}8 o$ o; c- {* ` X `7 R( Z/ U6 k
</script> |
|