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

|
网页之跑马灯文字特效
//修改宽度1 [! M2 e& O: E% r5 s1 X& F6 `
var marqueewidth=300% C5 r( R; R) S8 r# b
//高度5 p* u; |& D* N- j4 s1 z7 ` Q
var marqueeheight=25
% U& ^ `4 g1 s//速度(1-10)
0 s9 J# F6 _* v, N+ R( Uvar marqueespeed=3
& q1 z; j- H- }) [) ~8 f' o% U f//背景颜色
x) ?9 J J% R" L) wvar marqueebgcolor="#FFFFFF"
3 t4 ^ E. | x1 h; Y) ?//是否能暂停 (0=no. 1=yes)?
1 K; d4 s# r& c- v" O% M. Cvar pauseit=1
4 h/ w$ \- x6 L" n
+ v$ l7 \' x1 L5 [//修改显示内容* A* H% n7 X u7 a! ?9 Z0 ~
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'" l: t; n7 `# c5 n0 a) x2 c
* w/ Y. c2 S- P' ]2 j/ } \7 ]2 g6 c
6 V7 m, e t; r8 v, z////下面不需改变////////////0 q. h6 w( E' [: Y3 `: H
( b( T& K0 Z4 Bvar copyspeed=marqueespeed* B* `) z5 P: K4 ?' h4 V
var pausespeed=(pauseit==0)? copyspeed: 0
/ J: Y& J; D3 G8 R! Y8 Ovar iedom=document.all||document.getElementById
! L8 V7 Z$ r$ J$ X; A7 W2 V; Dif (iedom)
3 R; Q# e- F- U# Ldocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')0 N' O1 k. C# R, d/ ^5 i
var actualwidth=''' m, K2 T9 K) O9 g a) c; D
var cross_marquee, ns_marquee! K: U) D0 q; _
. p( ~+ D: x# g: {# V
function populate(){
& f/ J& Z$ l: Z0 j# @: z5 f/ Iif (iedom){3 g. ]3 S2 G0 L5 [
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee, {3 [7 {; `% G! v) A/ v
cross_marquee.style.left=marqueewidth+81 X2 C2 l- r# t9 z: v1 [6 C5 O3 _
cross_marquee.innerHTML=marqueecontent" r4 K N) I U1 T2 H
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth6 O, {" q- V- z+ u8 H9 T: R
}2 r+ e5 [9 h$ D
else if (document.layers){
" d: N M% A2 z2 w% S, R1 J: ?ns_marquee=document.ns_marquee.document.ns_marquee2
: V1 [/ {' ? V3 b. q6 v2 Mns_marquee.left=marqueewidth+8
8 [8 W1 `7 N$ p2 vns_marquee.document.write(marqueecontent)1 J5 P) W+ H* R Z. C
ns_marquee.document.close()
8 A, i" Q/ ^& V# M0 Dactualwidth=ns_marquee.document.width; B% }& ~5 E& L! ?/ U4 D! ?: v
}
- p8 p# O8 `- [ }3 Olefttime=setInterval("scrollmarquee()",20). d/ O6 a0 k/ r3 J$ d+ M
}$ ~, I9 I' n& X7 {
window.onload=populate: ?4 g5 t2 s! L) R5 d
9 I& T1 P# m5 k8 N. h( n
function scrollmarquee(){, b0 r. d/ r. t! r, [! O
if (iedom){( R2 y; ~. N7 j h y: {
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))" |5 E# h( L: |( B: e6 Y7 b8 T% p
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed6 U5 L4 ^+ `9 A$ G) U% I, ~( d
else
2 U; |# N0 K. A( w6 C9 o$ vcross_marquee.style.left=marqueewidth+8# A( o, B9 d: @7 y0 z' h5 u
7 T1 M/ E: y9 m" J+ t% V}5 V- c# W9 r" H0 t9 I% C! u
else if (document.layers){3 s7 c1 G1 O2 h9 r
if (ns_marquee.left>(actualwidth*(-1)+8))
1 \5 e: Y" [+ ~5 K4 ~3 rns_marquee.left-=copyspeed, d2 y, P( J! C: p+ W9 G; N3 h
else
) U) E( h. d) D# U+ E, Ons_marquee.left=marqueewidth+8
- B6 l4 c1 D# A/ N2 n}
% y6 |+ C9 ~" e: w}( R. v8 Z/ M# t7 L
. A$ z4 K A( ]: Y, vif (iedom||document.layers){
e: ~3 U( m2 U6 D1 Mwith (document){
; a0 ^8 c. L3 f) h# l0 a/ edocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
3 T! }8 g1 _9 e# xif (iedom){2 V$ B( R& P3 F/ n' a. J7 l* R
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
) J) M, K' K2 ?0 a' Iwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
% \) ]& V; W1 @5 q& ^! ~2 Hwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')1 h9 k4 Z" Z. v! H5 c( o$ M
write('</div>')
% ]4 l. n( H, W1 g}1 E! B ]" M c+ X- s
else if (document.layers){6 g2 H# Q' A- E
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
+ g- c! U& r, G$ Pwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')- X( L7 ^, V6 K) C/ @; u4 K
write('</ilayer>')6 [6 R9 o% i0 _! e
}
4 i/ z( w$ o4 o8 A+ Tdocument.write('</td></table>')
: M! q' O& ~) t5 e; d X}( @1 ]- `" {; O+ P8 ^! ?7 g
}
/ q/ V3 M4 u W/ b, P</script> |
|