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

|
网页之跑马灯文字特效
//修改宽度
8 N' d% j( ?* v/ wvar marqueewidth=300
' a* C9 k* s) E/ p//高度
5 \4 k M! g$ P+ W( |var marqueeheight=25& G( G' c8 f5 r# M, t+ |
//速度(1-10)
5 W' K* W0 V: H4 k7 M6 |var marqueespeed=3
6 k- M4 c6 ?! @4 p# Z//背景颜色& `/ O/ B3 v: l& m2 g9 U: T
var marqueebgcolor="#FFFFFF"1 {" b5 D- d8 g3 m! m; X' Q
//是否能暂停 (0=no. 1=yes)?2 d0 Y; o: D. O. S3 J; p
var pauseit=1( j) m. F! Z: m* ~# r! i) s
7 d3 q, J4 }! S9 j. ~& V* z/ I//修改显示内容8 E. y8 L! C5 f4 z8 w
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
* k" ^9 c1 b ]! t
9 b, W1 t) {: g2 t' k1 m8 h3 K% \& X
! v9 }0 i+ }+ U$ ^+ X Q////下面不需改变////////////' m2 p v: ~* b3 t7 Y
2 t5 z3 h0 d" @ K; e- @var copyspeed=marqueespeed5 W' h! S, R8 B6 H, f% a
var pausespeed=(pauseit==0)? copyspeed: 0" y& ?0 w" V+ `+ }
var iedom=document.all||document.getElementById
, x$ b! X: f5 O. p8 }6 qif (iedom)
- z9 H- [; Z% v) S+ \document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
/ a9 U2 b# w6 R. m, \; S$ q( Bvar actualwidth='': g7 D3 f6 F5 ?* `; f
var cross_marquee, ns_marquee
5 ^3 R2 @% O% F/ v+ _1 P2 D* j; o0 S8 e) a
function populate(){
* [, U! R3 l( X' V" ?if (iedom){& R7 E8 f/ A: _
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
. F" L3 h2 v4 v/ m+ O$ K4 across_marquee.style.left=marqueewidth+8
. s8 k( n+ b, j& X5 d/ xcross_marquee.innerHTML=marqueecontent
' T7 |! F* A) R5 U! Wactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
4 O8 S, C, t y* @}4 ^3 @; q2 I. [/ N
else if (document.layers){
7 l5 X# ]" E c* Q, Pns_marquee=document.ns_marquee.document.ns_marquee2
- q5 G+ x1 M- {, M/ V/ U; Pns_marquee.left=marqueewidth+88 r6 U) ?5 \% M. z' b& W8 y4 d
ns_marquee.document.write(marqueecontent)
! x0 n5 f7 K2 ^2 A2 |/ H9 bns_marquee.document.close()! Q1 l$ f2 _: L3 h/ p2 S! I9 U
actualwidth=ns_marquee.document.width
/ f- f* i# n9 |& p5 `. b* ?; ?}6 e8 q$ z k" z4 ?( b
lefttime=setInterval("scrollmarquee()",20)' w9 E# E: E- _
}$ P, x3 y/ e1 Z$ B
window.onload=populate
5 V0 K& Z& P! W% ?
$ }* T( h7 y9 F* p) A: rfunction scrollmarquee(){
( j& m0 n6 q! k- |% O$ Vif (iedom){
; I- o* K7 g# C6 m' O8 ^$ Dif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)) `6 M8 J" s2 [1 r: |. Z) k F7 z
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
( {1 W* z1 N3 T3 B5 r4 N- oelse
+ |, `& r' D! `2 gcross_marquee.style.left=marqueewidth+8
+ u5 B& u/ U. j
- B0 D4 J s1 ~6 f( j. Q$ d2 }}4 E' X0 m9 u6 Y8 V
else if (document.layers){8 A) ?9 h/ r2 B
if (ns_marquee.left>(actualwidth*(-1)+8))( ?* D, @. D# G/ e# S* a5 {' d
ns_marquee.left-=copyspeed
+ B- c0 g, d: Pelse
# Y5 @* @/ J1 e+ [; nns_marquee.left=marqueewidth+83 v9 A! L0 e. u. K
}
8 E% s# K! A) |( y3 R# d1 B}
g( X" B$ U8 l- Z( Y
2 B" N3 F- }6 W' T0 uif (iedom||document.layers){
6 b! l) ]1 j; V1 L3 c4 t0 Zwith (document){- w7 m2 w J6 I) G+ `
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
% D# l5 g6 F3 i4 w9 nif (iedom){+ g! N& N1 |& j4 a+ q1 g. g4 ~
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')5 d5 ?) T1 E6 R% a7 d
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
: Y! y0 m- H3 p0 w0 nwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
! r0 t4 e. g( k q- D0 ]! Lwrite('</div>')
9 U6 b5 D D0 c6 O}
+ H2 P+ n" J4 R; Ielse if (document.layers){
& u7 ^2 V2 \, @& p1 g' l7 Dwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')* e+ ?: Y3 Z8 {( J& B5 \
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')$ f' @/ V# w$ @* b' W
write('</ilayer>'); q/ w) l4 K5 t; \
}
1 O$ K, f+ G1 g2 E4 i7 o" vdocument.write('</td></table>')/ S4 w6 c, [5 g. {
}
& G# J9 w m1 c: y7 M2 K( k}
: {- ?% l' k$ p5 C, M. X</script> |
|