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

|
网页之跑马灯文字特效
//修改宽度( ^& `4 ~/ j5 l0 W4 F* N2 W+ `
var marqueewidth=3003 F+ O) X2 z5 y M, z, J
//高度/ A5 ]* _: [3 ^' v- `, a# F3 Y' o3 s
var marqueeheight=25
" h# D$ x' p' L( i( {! M V//速度(1-10)
, c8 o! F) X# B _7 @# Pvar marqueespeed=3- J4 x' J) R4 [7 e, v! ]- d4 v
//背景颜色2 ^+ S7 a+ s% `* d+ y$ L
var marqueebgcolor="#FFFFFF"" C! F- @' M: A9 f' g9 S
//是否能暂停 (0=no. 1=yes)?9 Z# m! `0 [ g2 b% @, C5 D
var pauseit=1+ M. g+ t) r c3 p1 d- e
5 b5 x: }" }8 \4 V" x: V
//修改显示内容8 s) l) Z& `0 X
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
[' S( j( q% L; }( \' H& w- t+ _0 I3 c
6 {. A7 n1 z, Z! H- f% V9 V6 u2 E////下面不需改变////////////
; S( o6 d N* x
( q) A& R' u' N$ K5 qvar copyspeed=marqueespeed1 N6 A9 q* a3 B4 H7 E) Q$ ~! p
var pausespeed=(pauseit==0)? copyspeed: 0
& L6 v$ y, \% q4 f- mvar iedom=document.all||document.getElementById
5 f* u; g* [0 aif (iedom)
+ H5 |& d3 T- m- zdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
7 |7 I- Z. C, o' I$ }var actualwidth=''" u7 p: f. ]& g. v1 r. F# P
var cross_marquee, ns_marquee
7 {1 y1 T! n. E |, ^
" x2 w% R! K' v1 afunction populate(){
+ v6 E3 P u& @! S4 Uif (iedom){# {* \5 a+ C2 u' v
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee; T9 {3 i! r0 Z4 M v- X
cross_marquee.style.left=marqueewidth+8
1 V: h9 w7 g. a! Icross_marquee.innerHTML=marqueecontent# j/ U$ m8 }# B7 R1 u; d
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
1 f- r3 Y. ~1 k2 A9 r$ q}0 n6 a, L/ H: j# Q! K' c
else if (document.layers){7 m5 |5 B9 q( r. o- b% N
ns_marquee=document.ns_marquee.document.ns_marquee2
& v5 k: Z6 g5 J7 Gns_marquee.left=marqueewidth+8
8 m! v# I+ W. J$ t4 sns_marquee.document.write(marqueecontent)
2 ~9 u \2 @+ b2 ^2 U' |0 |; bns_marquee.document.close()$ j3 j( t7 g6 k. }+ D8 S
actualwidth=ns_marquee.document.width
) \5 @1 F% Y* Y# J}8 a+ v) l! W6 T% N$ s$ K* t/ X& Y
lefttime=setInterval("scrollmarquee()",20)
0 r d5 \) W$ q; [5 r' l u$ c}
( Y5 L( P. e- ?window.onload=populate3 k9 y2 E) @' N) r. H. o
3 l" d) \' ]. l+ t: v
function scrollmarquee(){
* Y& k$ S+ g6 e) o( N% Oif (iedom){
4 n% k5 Q. c2 c; C' D5 t* Cif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
" i C+ |# g( E1 g8 l% Y' Q# ~/ Dcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed8 q9 N* }" K9 X+ t! ^
else* ?. w4 H, m$ Y; d1 h2 m* L
cross_marquee.style.left=marqueewidth+8
$ }6 ~! i$ C. v4 ]$ B' A7 }: E4 |( R: ]8 y& s" E
}
: K% I. W, \* g( l* A. Belse if (document.layers){% h% `1 i! N" o& R
if (ns_marquee.left>(actualwidth*(-1)+8)). a: a. f* J3 T% R' U. n& W
ns_marquee.left-=copyspeed
& E5 q9 q) e+ v m$ Telse. K8 n# _$ Q. q. W' n
ns_marquee.left=marqueewidth+8& G$ s4 l+ w3 f a% A3 u- x
}* J5 V8 k, S, D/ y3 x4 V
}
# x' O* ^# y, h
; y2 D' x6 G$ |: j/ Z! X( @if (iedom||document.layers){' Q& D" J2 @0 g) E# d: L
with (document){
( Q2 z8 V: a/ q1 V- ~ _; Zdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
6 U( I5 P& i* k" [) l! A: d3 Uif (iedom){
4 c1 Y" r* a$ ~/ a" }write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
5 a5 {- u) o, |: |$ L; `write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'): g3 X. L, @. z
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')2 z, ^0 Z9 f+ N H
write('</div>')
6 x/ u" w% b& K, O6 }- C}
7 v3 O3 Q6 @% D. u; [# {0 N" m, Gelse if (document.layers){
4 D! X4 g. n8 v4 o3 D% Pwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')3 {( {5 V l1 p2 b8 h5 z. p* t
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')+ h2 ^* A! _! X& R' i( B4 S
write('</ilayer>')
3 u1 ^- I$ `* [8 S}$ O: P* j: E; q& \' W; K' v
document.write('</td></table>')
3 O- c+ _1 Z _7 V1 S! }. G5 M}
# O1 z& l; n$ ?3 }7 g7 O; e9 p6 d}
; {5 U" A" p+ l' {+ q* e2 J$ |' W</script> |
|