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

|
网页之跑马灯文字特效
//修改宽度4 w, y; V8 w& C0 j! a4 O6 C4 x
var marqueewidth=300
3 W r6 @5 a8 X2 o8 a//高度6 H( p# R6 e2 W/ L b/ R
var marqueeheight=25! V# g V. g& i% ^! l
//速度(1-10)6 a0 j; l8 y' p$ F0 f9 D) v M' K
var marqueespeed=3+ b! X6 E; f5 ~
//背景颜色3 Y- M( {- m: o' G, r$ K1 G
var marqueebgcolor="#FFFFFF"
* e) B, d: Z1 y. s5 h0 {* ~( l//是否能暂停 (0=no. 1=yes)?
2 o5 E ]# K' `' z5 tvar pauseit=1 B7 Q9 D& ?5 H1 A6 b- \
$ Z' O5 t0 d! `/ N: N/ e
//修改显示内容
+ s' H. w- ^; ~1 \9 M4 Z$ r! V. p' |var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'4 _( x. r2 T! u9 S8 I
0 J. |0 X* ~& u( g
( @) [) E8 l( g; b9 j- L////下面不需改变////////////) f7 a6 O2 E1 y/ O8 j
" F+ q2 \. }. @6 N. w4 ^( i
var copyspeed=marqueespeed
" ]- e' a* b+ j/ rvar pausespeed=(pauseit==0)? copyspeed: 0
8 R5 x3 w. E2 k3 D$ m7 wvar iedom=document.all||document.getElementById
/ |; \& R, q4 Q* cif (iedom)- s( ?4 i; L7 Z4 z% Z) n
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
# _- h" O4 ~7 N. ^; N5 @# Zvar actualwidth=''
/ }8 s$ c( ~2 e) p2 avar cross_marquee, ns_marquee
$ w& [" C' o" Q ~+ v! T @2 x- B& H5 H' U' |. p# `8 S4 K
function populate(){6 o. y' k0 A+ s; S
if (iedom){) M7 k3 T8 C6 Y2 f% m2 m
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
3 L% C6 ?2 J8 T8 q2 Y0 W% ?cross_marquee.style.left=marqueewidth+82 h( w9 P1 R) f) s7 b: e
cross_marquee.innerHTML=marqueecontent
6 ~, H" F& D: b. @: [6 Hactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth* g- }: e/ w9 ~( F& O1 a7 u3 W, T
}
5 @; o! b( u+ }' F5 |else if (document.layers){
8 l+ G2 n! `3 L8 n/ Lns_marquee=document.ns_marquee.document.ns_marquee2
, P& [0 F/ G# Tns_marquee.left=marqueewidth+85 q# b1 }; u! S) E: N
ns_marquee.document.write(marqueecontent)
0 f2 q! S0 e8 h |ns_marquee.document.close(): J; q7 l' s$ Z( }' E! @/ @/ i2 R
actualwidth=ns_marquee.document.width% s* E# s5 b* j% T' C1 H# H
}& F* o8 `1 K! x6 H
lefttime=setInterval("scrollmarquee()",20)
7 A( Q7 g5 t/ N B}
. ?5 E/ i7 Z% F" {1 x" Iwindow.onload=populate
$ _; H$ s$ I A) D+ j. v0 l! ]- R# }# ~3 C4 T/ @ U
function scrollmarquee(){
6 H) |1 j N w: ~, Iif (iedom){
- L' ?: b; p7 `+ zif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))4 B0 i7 X" l3 r* d& t2 J# O
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed; w: V, H$ u. r! k
else- f2 {( Q! c3 {8 p
cross_marquee.style.left=marqueewidth+86 w1 x" ?2 s/ y4 f6 A& v9 y. k( V
+ A& t& e3 y! s- v
}% `8 D3 b+ E8 r5 ^) |
else if (document.layers){
7 E% G. b8 w# _* rif (ns_marquee.left>(actualwidth*(-1)+8))6 s9 T# \( K: V5 }% t* Q6 K
ns_marquee.left-=copyspeed, F+ O5 x% T8 W& v& E- `5 k. q
else
8 f, P- C7 ~" b7 @ns_marquee.left=marqueewidth+8
7 {3 S" {4 Q; W' {}
/ f) x7 i0 B+ B" u. u# e}
" `' Y4 I. t3 D% L! Z+ _
) l/ h, m! E$ c4 aif (iedom||document.layers){9 K7 r* }9 e( w* L$ B$ x/ v4 r
with (document){
% y4 P9 I$ d( `/ e ?# Kdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')2 C; e C- \( X$ V# `$ U9 C
if (iedom){
$ d! ^; r- U! Z! Awrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')! s6 h& t! Q$ _9 [
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
7 C+ q5 w8 g, X) P. }# y* c0 t% y2 U3 {0 zwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')2 r" [& e8 n" V! y( q1 R
write('</div>')% Z2 a. x) l7 ^! G. V' y- X4 t# v
}
* u, O; G! j* I3 v: G% pelse if (document.layers){
7 E, W/ K! ~& P9 S$ ewrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
- w% R- q3 z9 j7 b5 X) _write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')( t9 ?1 v" j: u6 A# S1 v; s
write('</ilayer>')- K; l, Q, z, U6 R1 J
}
8 c$ u7 l8 P8 U$ o! A( ydocument.write('</td></table>')
, N; R% r" ~ x2 t}
! `1 w Y5 t' _" x) H; W}
2 l4 S2 f: T F% A9 i8 ~6 u( Q9 p" S8 d</script> |
|