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

|
网页之跑马灯文字特效
//修改宽度3 u/ p- ], n' n! X3 o6 D; o) q1 k" \
var marqueewidth=3008 J! Y" h$ h' \9 ~
//高度- \9 l- Y$ w" g6 |+ J, P7 a
var marqueeheight=25
! {! Z2 y; @* Z, g/ \//速度(1-10)
7 ^) M- W8 k1 n$ S1 u1 y) V3 s( z/ c1 Cvar marqueespeed=3
" v2 e/ n+ t/ m4 b//背景颜色* B, ^0 q; x B B. Z j/ e9 D
var marqueebgcolor="#FFFFFF"; M+ v1 m$ A9 |$ f/ t* ?: ]# P
//是否能暂停 (0=no. 1=yes)?
: Z! I W/ U/ {$ Q5 g9 s- Uvar pauseit=1: ~/ i. S# C' D7 h* R# Z) d$ o
/ I- T. J4 r2 K$ Z' q% ]//修改显示内容
- n% U. l+ g) U8 a) x- G, Mvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
* U# S6 {" {$ w( @- ^2 j H% R' R |
9 \- E- Q1 P& o6 I* [( r
////下面不需改变////////////' C a' e9 d8 Z) l9 T* Y
! g, a% Y& V; G- }, m
var copyspeed=marqueespeed& d% {/ @& n0 f
var pausespeed=(pauseit==0)? copyspeed: 0/ {5 s& x2 s" b$ M; L0 E
var iedom=document.all||document.getElementById/ f" n R$ @) Q, O) p0 `% ?7 ?
if (iedom)
& E' t( m) W3 s' s" {# rdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')7 c0 P( M, ~: [4 ]/ ]% }! ~
var actualwidth=''$ @5 s! z V2 _& X- r# S
var cross_marquee, ns_marquee
# J! y2 R2 r6 `, h) y
; a s" L& Y7 N9 T; L2 dfunction populate(){
0 c- ~4 D# G! z2 B9 f4 q8 Gif (iedom){1 B$ H2 S( O+ w
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee6 }0 e' O6 L* h& R( f. R7 w, |9 e
cross_marquee.style.left=marqueewidth+8
/ C7 v9 U/ O5 @+ e0 |cross_marquee.innerHTML=marqueecontent r7 }( c0 o* Q& p# D' F2 A/ h
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
( p0 `. W& M4 P6 E3 P}
. ?1 A! L& L6 G6 c, X7 yelse if (document.layers){
+ G( y0 l3 U$ M* s, K3 V- Vns_marquee=document.ns_marquee.document.ns_marquee2( @2 B* V; j6 P' o
ns_marquee.left=marqueewidth+8 V! R* b& d- c' l4 f
ns_marquee.document.write(marqueecontent)0 {3 c2 I5 r% C8 `, [
ns_marquee.document.close()
; i/ U2 ^ R% D8 ?: wactualwidth=ns_marquee.document.width
- a% R4 s* j3 ^. `9 `( B* d}
* N; a- h6 E, @: k Flefttime=setInterval("scrollmarquee()",20)+ Q1 `: m. d! \) R5 H* }
}# H! Z+ C# {8 \
window.onload=populate
% w8 N* x. _( O. H& F0 i5 j y/ T( @: C" r
function scrollmarquee(){1 f/ B% s: n; ~; d; I0 i( O9 K
if (iedom){
% J1 Z! H' [. \: Z4 }if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))( u, v/ |9 D/ l: k. X' L+ ? g
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed; r- r2 f, O* M: r& N
else" ^0 j9 e5 Z4 k5 Q) A
cross_marquee.style.left=marqueewidth+8' f+ p! a/ X6 W' m8 G. [
, z" C$ F7 ?/ c7 n; F' \}
- W7 ?. e" d, ?! i5 U3 @5 welse if (document.layers){
2 A6 {9 Z8 o! G. o+ @if (ns_marquee.left>(actualwidth*(-1)+8))
; V$ K2 A' l: k! S/ c' O. Dns_marquee.left-=copyspeed
/ ?% D" y5 t- oelse
9 p. M# x6 w$ Ins_marquee.left=marqueewidth+8
6 D2 U. K% W4 }4 y T}6 L3 W. i+ y2 E/ }3 f, J
}
1 ~6 n$ i5 X. q' ~2 |, C
6 c$ M5 K( x' Q& pif (iedom||document.layers){# `, F! {. S' l- s
with (document){ O/ f1 }" m1 C
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>'). o; E- F6 H! O/ `3 S, |
if (iedom){
' M2 N, \/ V$ G+ H2 ~% ewrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')6 S1 _+ O {$ N+ P4 k; y
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
5 X8 U: r3 U0 D' X$ ^1 Wwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')( u7 E: m1 ~4 f6 q7 ~
write('</div>')5 k0 p, S* |0 ]* y0 j2 q0 k. o% ~
}) m, a# W' \0 D1 {5 Z, j$ B9 _3 x9 Y
else if (document.layers){- u# Y! v3 M5 M- ^& t6 d" h) h
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
# p+ n) ^# Y, x; I8 g$ v' Z, X- ^- owrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')' C3 X2 R. c9 ^6 N
write('</ilayer>')
( l0 Y% d; }0 T5 [( t5 i" }}/ v [( k- o0 K7 O' G
document.write('</td></table>')! c8 U) R- M/ b- ~/ h
}
: w6 Y4 f3 R4 v! a3 _}
/ c% s! i4 l6 j% `1 x) C j</script> |
|