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

|
网页之跑马灯文字特效
//修改宽度
- U7 H0 v7 j3 x# b) L5 ivar marqueewidth=300
, _- E a1 ?, `//高度
$ B! a4 E3 ^3 G6 J$ i- \- b% U9 Mvar marqueeheight=25
, \3 q. C; e5 X//速度(1-10)6 V" N: {$ G4 N2 u1 F Z, F
var marqueespeed=3
9 V4 X6 i. P/ `3 `; E4 Q0 J' @//背景颜色0 y1 h" S& |5 K1 [3 {
var marqueebgcolor="#FFFFFF", @$ E+ b$ F$ J( m+ p% Z
//是否能暂停 (0=no. 1=yes)?
+ j* L7 P' @" O) F# E8 cvar pauseit=1
) i0 B$ {5 b3 ~1 s8 n2 v5 I: y9 G. e% ?7 f: m; S
//修改显示内容2 {* P! {# g3 I X" Q- w' l0 R
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
4 u) c5 M3 Y" k
/ G. w+ v9 E0 t; S6 R
' h/ i% P2 @6 h* e' \, r9 U////下面不需改变////////////9 f9 n! T9 p9 h/ t
% u6 T7 a6 A% f4 q2 q# J, l
var copyspeed=marqueespeed8 _! b }6 U9 S; D
var pausespeed=(pauseit==0)? copyspeed: 0
6 @3 _% o" W5 K* |. s. }+ jvar iedom=document.all||document.getElementById
2 x+ @, |, f0 _, m) d$ pif (iedom)
0 k% y/ p* b: D7 Rdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>') p6 ^, A) k( o4 ]# W, o
var actualwidth=''
! j+ X4 R$ o: o6 e( Yvar cross_marquee, ns_marquee+ l! {, s# I. @! ~& `( E
3 U" B# S3 Q! xfunction populate(){) }1 @! D& {% _7 l) x
if (iedom){& T5 p' y8 b4 A, _! n5 C; T# l
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
" p/ k R, K2 ]( f5 Z/ Scross_marquee.style.left=marqueewidth+8
! `2 C# [/ {$ N! R8 fcross_marquee.innerHTML=marqueecontent) `, W/ @4 |, R3 K, _' ~% ?
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth4 d9 }" G( a1 B4 G1 R
}
! N) q( T. H9 w& k! M2 R$ P- felse if (document.layers){
; P) ~. Q. A, g0 A8 lns_marquee=document.ns_marquee.document.ns_marquee2
! Q; z' K3 c) {- ?. kns_marquee.left=marqueewidth+8
2 x! t! v7 X) m8 ]ns_marquee.document.write(marqueecontent)8 v6 d5 {5 V2 `' l9 s* u
ns_marquee.document.close()
) ]8 o" J* u: J( {4 k( r7 q$ E3 z3 Iactualwidth=ns_marquee.document.width
$ D6 C# C( V: N) ^# s0 U}
$ w2 Z- C; p" T1 ?/ R& Klefttime=setInterval("scrollmarquee()",20)* w8 S: o2 P; h/ z+ x3 Z
}; i# V5 _! c$ g) q
window.onload=populate! _8 b* P3 r$ b( f0 M
3 J$ ^' f2 ^6 ]3 `0 ]- m/ t7 E5 tfunction scrollmarquee(){
8 E' t6 l" M9 F, n3 G0 mif (iedom){
9 t$ c2 a! L1 k7 C$ ?: n! I+ oif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
7 S8 K$ [+ |& C' {* A5 u9 I! |cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
7 V& t& ?4 Q+ {1 K. ielse. h6 E" u3 Y6 ~, ~$ C& Y# N9 Y) Z
cross_marquee.style.left=marqueewidth+8
4 w4 f& _3 N- ]; d2 y! d2 V4 {2 z9 [
}; Z2 a9 I" J! j6 I: B
else if (document.layers){/ ]9 G4 \% o* _% {% {( p
if (ns_marquee.left>(actualwidth*(-1)+8))1 S) O: c- O; R: A! d
ns_marquee.left-=copyspeed7 I4 q- T0 i$ p4 W Z) M9 u! s) Z
else3 N: Z( v8 n" f( [ u6 m# y0 }
ns_marquee.left=marqueewidth+8
& K/ J) m4 ^) E J5 e' S+ z+ K% q}# b+ R) O' z1 V
}
0 {5 R. }' A, } ]# K% z _: @
; X/ s- x& b+ t3 p7 k0 Zif (iedom||document.layers){
* f( V/ Q" E. T; p& }% m4 ewith (document){
|% ~, e& m; ~- z% `document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
/ }; I( Y9 U: {2 B" g/ A/ Oif (iedom){
+ o; Z9 p" D) H" {- q" Y" x) vwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'). b4 ?( q! V0 }; I( \
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')6 o+ K8 }% p, R9 {( ?+ C: |
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')/ v# r8 A/ _8 f, z( i6 A9 w# i
write('</div>')! @ _* l7 ?& R8 @; b3 T9 N
}. q# V# j2 M D; K' Y$ ~0 L# T
else if (document.layers){
5 Q! }3 Y6 Z: i, f3 ~5 ~write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
' m1 ^" w* I/ b/ e' B4 Z; ]write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
. O: A( O) v$ D8 {6 v* `write('</ilayer>')
2 v9 M+ a' U2 e9 k7 ?+ Q}
& R1 k+ m$ E3 a/ N1 h& A' }document.write('</td></table>')8 z6 T! S5 v6 p" ^
}0 J, k$ r" K, v. b9 K# o
}
( Z3 e: \- D: w3 D: ]</script> |
|