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

|
网页之跑马灯文字特效
//修改宽度/ K+ @! @+ _8 r" ^$ h. K
var marqueewidth=300- h# a% W+ }$ [! O4 h
//高度
2 H' X1 ^3 ]4 A* a7 kvar marqueeheight=25
# D$ \& R* B3 w1 P- v" f! u//速度(1-10): U- a. c3 n) R
var marqueespeed=3 A& X0 j( b8 v1 ~7 F. o7 f
//背景颜色
2 m' v! g6 K- q0 rvar marqueebgcolor="#FFFFFF"
! e% V5 l5 R5 h" j( f0 ~/ ]5 M- S) Z//是否能暂停 (0=no. 1=yes)?% f3 D* h3 d0 s& M8 D- T6 E
var pauseit=1
0 T P1 u% O8 w. z6 ]7 J2 W9 V9 \
; k4 }! y. O4 M* |2 w3 M" I% a' m//修改显示内容
- J' C5 S$ j, [1 d' Z$ e6 s$ uvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
; l$ ^( B2 A8 F3 M
) E9 g- i( ^! _' p$ Q: b$ D- k6 O, f% Y$ q" c
////下面不需改变////////////
! f" L3 i3 z/ u* S
& W# j* s3 c- h0 r! Xvar copyspeed=marqueespeed* e/ l5 g* @6 D6 _; V5 P1 L
var pausespeed=(pauseit==0)? copyspeed: 0$ F% \1 Y) a. } P L+ i. M
var iedom=document.all||document.getElementById! H3 ^! {1 T1 ^6 h9 c: x3 v' d1 T
if (iedom)
+ g$ d& u+ `6 A8 T' Jdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')( U% [8 Q1 n2 x% S6 {
var actualwidth=''" V. z! X5 t3 e* N
var cross_marquee, ns_marquee' u0 b$ P& o6 l0 e) _, c" _
1 I" N# j7 h6 g& R8 J3 {function populate(){
( _, o$ H& k# {8 Bif (iedom){
7 r8 i( z, z( ^0 H$ ~4 |cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee& r! w2 g1 Z2 E+ F$ D( c
cross_marquee.style.left=marqueewidth+8! l% P' P& r" i8 k
cross_marquee.innerHTML=marqueecontent3 k; f }& f& o
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth7 d4 t' K+ y" s: K: Y
}& T$ F/ T2 Z0 T9 ]7 {( D) Q. w
else if (document.layers){
: G+ K" Z3 m0 f6 p$ k- tns_marquee=document.ns_marquee.document.ns_marquee2
6 T+ O: w2 u i& U; Ans_marquee.left=marqueewidth+8
7 \1 D# ?; p! dns_marquee.document.write(marqueecontent); J+ O* Z1 z: u* B5 B; E3 W
ns_marquee.document.close()
7 M0 k! u( W' r- sactualwidth=ns_marquee.document.width
( o8 j: p7 c) r7 j0 f# }) P}/ Y# S1 k3 [( r7 p
lefttime=setInterval("scrollmarquee()",20)
/ B3 S5 Q2 C' X. Q}: ^6 x5 x. j& F+ f' _. U: H4 C
window.onload=populate* W3 p5 u& e, m
5 ]8 h+ z$ d* _) j6 r
function scrollmarquee(){
: D1 B6 |9 m; P4 s- V, S& a9 Bif (iedom){" U1 G. R; w: u M9 O
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))) A( t+ X2 j* R9 _
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed0 b4 b0 y. u/ R; B. a. U+ H/ W7 p7 L
else& C. X+ ^ g" _- v, P' ~
cross_marquee.style.left=marqueewidth+83 w3 L7 J8 m0 S/ K8 q
, @' z! O' Y" C+ u! h; K3 ]6 K
}
* E/ R& [( z r! Pelse if (document.layers){1 A ^% c3 H* v: X2 i
if (ns_marquee.left>(actualwidth*(-1)+8))( e f/ O' ?. I6 K( \& N
ns_marquee.left-=copyspeed) G5 D+ f- i4 p: f
else0 O' d b2 k: d X- Y e& H0 y
ns_marquee.left=marqueewidth+8
' H, ?: E7 q; h- T$ i# c}
0 W+ r0 N5 I2 x9 X8 m' C}3 t! |. j6 s; K% j' T1 |5 j; L
8 o/ a, C. \ m Z/ @! mif (iedom||document.layers){
% X- Q9 W+ Y7 Y5 B& G& }with (document){
6 l# R. H7 [9 [' f. V, Wdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
0 b$ }4 p6 C) B) W) ~+ `) Oif (iedom){
' m& T/ S- ?5 lwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
. D$ Z9 `& ]) a4 i: s/ ?write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
: n3 \) s* h8 J( I) E! ]; O' d3 X9 L0 Vwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
) N) G& }/ q) t/ O# n5 ^write('</div>')( O8 A. \0 f. f4 B8 k! L: F1 L! b
}
) q% o l9 p9 ]% M( kelse if (document.layers){
- [: p# Y5 W4 C% n4 t6 S: nwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
3 c1 F' F& c2 M& o, U, Z' Dwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')6 ~+ X' b/ V* T: b
write('</ilayer>')
! `. j$ n6 {- V}$ K) W$ o; M, O. n
document.write('</td></table>')
' q3 M8 j, D! ^5 n( e}
2 Y3 v* V" w5 z; O+ Q}) E& T1 J8 g" |- D2 `, S
</script> |
|