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

|
网页之跑马灯文字特效
//修改宽度& n$ U7 m& C$ h0 S$ n1 ~: g
var marqueewidth=300/ M C$ d& X; q
//高度4 c5 `1 `4 e3 s) [& W
var marqueeheight=251 h# J' q; c; V" R* P2 a" k! V
//速度(1-10)8 h8 f! Y- Y( K' V* d# P8 K: a
var marqueespeed=3$ l' B8 W$ n h% v
//背景颜色0 G. Z2 u& `/ X7 Q7 R6 G
var marqueebgcolor="#FFFFFF"
, ~1 X& j. R, @: L% u L8 g7 P//是否能暂停 (0=no. 1=yes)?
# e) p& e2 h& A; lvar pauseit=13 C& y0 F7 j& j
! f' f$ z: h( b: g) H9 K2 v- c( S//修改显示内容& L; \4 X* Q: V& D: r7 d
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
4 K3 p3 p6 }0 j9 L0 V- b. p- @$ t- d% O* z" J
& [' c0 ^& A- S0 C* ^' ]- Q* @
////下面不需改变////////////
' j( F. f. |# Z* n p* u' q4 Y. m( O& I4 b U& Q7 q
var copyspeed=marqueespeed6 U) |0 y: [, g# L* h( j0 |# N
var pausespeed=(pauseit==0)? copyspeed: 0
# g% p9 d& U5 Z$ P! K+ mvar iedom=document.all||document.getElementById
- v; P) H4 F! t: Fif (iedom)
3 h& P5 }; w2 @7 Idocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
' ~' h" B. l6 u: }4 K+ ~, E2 u5 {var actualwidth=''
; g( V1 O0 R1 H2 ~* Avar cross_marquee, ns_marquee
& p+ x5 w7 {& f) v; w) y8 x/ L- ]3 i
function populate(){
- T2 ~/ |9 c" Z; \! nif (iedom){
Q6 k1 x5 ^5 ncross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee9 ]! w+ [" r/ V8 B1 I, S
cross_marquee.style.left=marqueewidth+8
+ l5 P1 c1 l* S4 gcross_marquee.innerHTML=marqueecontent
. k; j4 N% q& b4 n2 V$ X: Hactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth1 k- t8 s4 k: r3 s
}
) r) F( i* M% Q( W& V, Y% b1 G/ ]1 celse if (document.layers){
) o9 L9 g- W5 I# s9 G Nns_marquee=document.ns_marquee.document.ns_marquee2& f: v+ G4 N% K5 c/ b- |
ns_marquee.left=marqueewidth+84 j4 |8 C) C9 ~
ns_marquee.document.write(marqueecontent)
. r* ]2 D0 ?. j0 z/ p8 {) D' jns_marquee.document.close()5 W4 n/ a4 E. F) O& ~
actualwidth=ns_marquee.document.width
. ?' E% R7 `8 [}
. y8 x" F+ Z' N" [lefttime=setInterval("scrollmarquee()",20), e+ C( K# @+ c* F4 K# F
}
* S4 p0 i5 M* s# j# c+ l1 Dwindow.onload=populate
+ l% d4 S, z9 g' w9 t( ~0 P b
+ A* R, j: K9 C! `. M2 Afunction scrollmarquee(){$ b) }8 l& r" z' J& _7 f- _
if (iedom){
5 Q: A+ B' V) p- ~if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
( E: M' n) M' i K# U" o- {cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed! [$ F" R2 z1 J1 g
else; j# u5 J; [0 ]+ I4 m
cross_marquee.style.left=marqueewidth+89 o( l7 u8 }( V9 k$ n2 G
3 Z! O4 f, F# M& k3 X$ m}
: N$ M: S( E+ t1 @/ t; T9 ?else if (document.layers){
0 ]/ p: k% v: H8 p- Xif (ns_marquee.left>(actualwidth*(-1)+8))- ?" Y5 ^- ^7 m# _2 B% q
ns_marquee.left-=copyspeed
& \0 n- s$ q7 u' o2 b6 ^+ |else* T& W9 { G) k$ `. c
ns_marquee.left=marqueewidth+8
. `* T' W w+ H/ j} S* u1 o! L0 N, Z* b+ D
}# i8 ? G+ M. X, _0 j0 y
- ?" b! ~* t4 q' S$ |% j
if (iedom||document.layers){
* C2 T0 y7 ?8 g e4 f- zwith (document){
8 C: [$ m% X$ ?1 Vdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')& Z8 ?( C0 P; F( j- y) g
if (iedom){
. ]! d( }% L% h- n3 \, ^) Iwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
2 f1 H! E4 {- F6 Zwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')6 ?) f7 @/ a! ?" j
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
3 ^6 D0 N% D+ `5 ^$ l/ _/ g7 F8 zwrite('</div>')- W0 p7 w# ?+ e( d
}! {* O5 ~ \. \! x4 C" Q" Z+ C8 _
else if (document.layers){
$ I! @ ~$ w: _' Awrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')1 ]4 g3 q0 R2 [9 E
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
6 Q* Y# Y" _2 `' ~write('</ilayer>')' W: _; l# A& W& K2 r8 w
}
1 Y6 i* r1 Z' |, z+ F7 V0 f9 ]document.write('</td></table>')0 W7 a' ?4 B% T- F. m. m; Q
}
b4 x! |+ ]! |% H$ `7 E& G2 s}
1 u% ?) G6 e. L: V6 H% x</script> |
|