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

|
网页之跑马灯文字特效
//修改宽度
v5 ~: {2 }2 f! f% k% l' Y- T& Avar marqueewidth=300
6 y% `1 n! q1 Y0 L8 t* [$ L0 x2 g, S//高度: } {4 \6 z q
var marqueeheight=25
: [. ^( ^- a, i//速度(1-10)
; G w) {; W8 ]4 B5 nvar marqueespeed=3$ q7 l" x+ a/ V
//背景颜色
) A6 M5 P4 r' W6 C/ bvar marqueebgcolor="#FFFFFF"# u4 L8 R4 e/ d9 Q4 k5 \) ]$ p% N" e
//是否能暂停 (0=no. 1=yes)?+ I" ^" x+ x% i0 {# c. v
var pauseit=1
) @$ @- t& N2 d
, L! I" z, z% n: o1 l" r% D//修改显示内容+ G" ?" C8 t* C$ G( {/ x
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
( ^! x; {7 u* d% C. q j6 f. g9 C2 c) q5 v G z5 ~
* c" R+ c# z3 k) N d/ U" }" J& V8 d
////下面不需改变////////////
5 x- M- Y% {" m! {* @+ A7 F/ ^$ x4 j
var copyspeed=marqueespeed
4 T+ A Y, I2 H0 Bvar pausespeed=(pauseit==0)? copyspeed: 0' x0 T/ n$ M4 R. n. E
var iedom=document.all||document.getElementById$ p( J% J* F7 B1 C9 h, n0 M* ]
if (iedom)2 I9 S, r) {: [1 s- t
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')) z$ m1 N! P& q
var actualwidth=''0 H o2 r4 w4 E1 |) q
var cross_marquee, ns_marquee
1 _0 T% [; Y3 r; G0 @, y" u
5 k# u: w" d: pfunction populate(){
$ z3 g* @: v- aif (iedom){5 g7 e7 s( {: _( n6 n
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee9 }, ]7 e( @; U x
cross_marquee.style.left=marqueewidth+8( L( G8 ~2 s+ l, ]4 Y) V
cross_marquee.innerHTML=marqueecontent
- F, f R7 {7 R9 Tactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
$ u+ P0 ~: C; [! V5 x$ i}8 u- U# T7 X' y( v) M3 z3 e- H
else if (document.layers){: @) H* T4 q( C G6 t3 t! ^: n G& Z) L% K
ns_marquee=document.ns_marquee.document.ns_marquee2# {: y& V2 E0 S# C$ b4 @
ns_marquee.left=marqueewidth+8
9 ]5 q% H; v; z( L& y" Tns_marquee.document.write(marqueecontent)8 b. v: X6 _; k0 [1 _5 v/ }
ns_marquee.document.close(): C% ~# }, P* Y5 b9 _( N
actualwidth=ns_marquee.document.width! [0 R- K p3 D/ E, W
}
# M8 h9 B% J" ?: C6 w' alefttime=setInterval("scrollmarquee()",20)' o, [3 R1 T- Q& k) y
}+ F/ s- @9 O( S, w
window.onload=populate, s" ?) E& g( X g
( ?- Y/ n3 K; ^6 V& Z: q/ }function scrollmarquee(){. V: `# | S+ C" z" I, E9 z
if (iedom){' {( W: t7 |" @2 b7 z
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
( D0 o8 ^1 ~4 p) {cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed6 s+ @8 O2 `( L2 P- F) c
else# M+ a' x* L4 U8 }( v! F% W
cross_marquee.style.left=marqueewidth+8
& i4 p C: q5 _8 Q; j
+ e, d. z# b- P% v2 w3 \}- m- _% W% D/ a
else if (document.layers){
4 e* a7 N1 ?; g' X, gif (ns_marquee.left>(actualwidth*(-1)+8))* v9 Q3 W; Q+ C5 D. m6 K
ns_marquee.left-=copyspeed
! a6 d, ?: O$ E, y. melse
1 X" E' l3 ~% C2 W" pns_marquee.left=marqueewidth+8
! P$ B3 e4 z3 u3 B( K}3 {8 c$ C2 P9 o
}
/ g5 m" d3 w9 I9 p, j4 g( |# [: N4 r% T/ O; U5 @; l: s+ f3 Y
if (iedom||document.layers){
% ^6 ?8 D$ |9 i) ^. B+ K, Cwith (document){" A/ m5 y, O8 u; I
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
4 L5 z/ O; g$ T7 Uif (iedom){
$ y! p3 {5 a5 C( O. Qwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
: o+ h4 s# g2 g. _& o6 h6 r# Kwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')! e, D4 z9 m) w( {' X) W5 x
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
$ T* P' W2 b1 K7 ~( @1 s# @5 dwrite('</div>')
8 _( b1 o! M q0 |! `+ m}
! M# t( k. z7 B3 g9 ]# velse if (document.layers){
2 }8 V4 ^6 S9 b Hwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')5 E6 O8 j1 A+ z4 q- R# p% J, ~: M
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')5 i; F0 X- c+ b* c) g
write('</ilayer>')/ R1 m- j& s; W4 P, J
}
9 j- U' z6 k, m* i: o4 x3 ~' |document.write('</td></table>'), E: L! Z# {1 {/ }, h
} }# B# S6 K+ t! N2 @7 K
}, g5 W% y e7 y
</script> |
|