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

|
网页之跑马灯文字特效
//修改宽度
?% G1 j. x% f0 n! O0 evar marqueewidth=300
& K5 F+ ~5 j9 h/ Z: }1 x+ d//高度$ b" e1 o& R: ^. `
var marqueeheight=251 T# d z% x5 d. ?% M% ]1 M2 }
//速度(1-10)3 G. P& l3 F! `" U2 K% E
var marqueespeed=3* h" _" K: w3 Q3 u0 f+ q1 D% l# x
//背景颜色
$ j) P2 Z' _+ `2 D d$ z9 }var marqueebgcolor="#FFFFFF"
5 I2 }0 s3 n# X* H3 Q5 d) g5 X/ t" D/ z//是否能暂停 (0=no. 1=yes)?, K' O5 i8 |' I
var pauseit=1
6 i$ B) M- ]% d7 V
2 K$ y- i3 _; m7 g h ~' r//修改显示内容; P/ E0 h7 f3 B7 {3 q
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'& p4 O! E* u! S+ f5 `' V) Z" _3 c' |9 z
5 F- ^+ Z( |* e: R/ ^8 b
% ]( y" J+ [3 z) m6 ~6 V, _////下面不需改变////////////% L6 z" X+ ]4 C& e4 V/ ?4 t! ?
( g! ?1 m2 S' xvar copyspeed=marqueespeed( d/ G: u" G8 c) x8 Y: e4 i: E
var pausespeed=(pauseit==0)? copyspeed: 0
1 h$ d- P9 U% \' X; dvar iedom=document.all||document.getElementById
* q9 _0 q" Z( W" a0 K; C' Q- ~- b# Dif (iedom)
1 D- n+ V% U* H' A- |! Odocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
( q8 x* J( E3 c( lvar actualwidth=''
( K+ r" l; H6 r* wvar cross_marquee, ns_marquee G; [" z- ~# `: \# D
" R7 u9 @- N- i2 T, `* }
function populate(){
0 {: A/ q" M& [5 k6 }4 ^ ?' Aif (iedom){' E' {4 G& s) g, W1 |
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
( o3 a9 h+ |# i8 K9 Q2 j# mcross_marquee.style.left=marqueewidth+8
3 ~ v, e2 D5 s# [cross_marquee.innerHTML=marqueecontent: c6 V7 N. P5 v% O$ v3 b& [
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
6 r3 o& A! b) }+ p5 n! v}' J) H8 q# ]0 {! i# r0 I2 E
else if (document.layers){
3 U' R) D5 h! w- h5 d9 Kns_marquee=document.ns_marquee.document.ns_marquee2) {5 ` u7 r& A {) c% T- z5 ^
ns_marquee.left=marqueewidth+8" m+ C, f4 I$ j/ k) p) q% W' y
ns_marquee.document.write(marqueecontent). T7 V3 K6 P- e: l. ~) ]* f
ns_marquee.document.close()
! h! U0 l* B2 {) X2 K5 Y% ractualwidth=ns_marquee.document.width: r0 z! I" J& C; G+ ~
}
! W- h. D2 a- V8 X& E/ klefttime=setInterval("scrollmarquee()",20)4 J* L# O8 C7 o$ ^$ N& N- \
}7 z- l! [* e3 r1 h, P0 _' |
window.onload=populate
, t/ ?/ \0 Y/ y0 ]0 w1 h0 X* f7 g. V6 s1 f; q. ~
function scrollmarquee(){
* Q" M5 e4 Y, u5 o! @9 ]2 `7 p' s& Rif (iedom){* T/ z* s/ ~- b2 E
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
3 x9 [3 ~$ a# a9 z) Q& v8 [cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
, T6 W$ \" \7 ^/ x$ n% l5 m* oelse6 v% V/ L! V x# K* R4 d
cross_marquee.style.left=marqueewidth+89 f4 q8 ]4 i/ S5 U* f
. f, F! N9 I2 w+ G% R$ Y) ]}: {% ~) f0 m6 b! z
else if (document.layers){2 p( ^: c9 k- V# f& c" }
if (ns_marquee.left>(actualwidth*(-1)+8))
7 P0 Q8 M+ A3 \9 t9 Z# cns_marquee.left-=copyspeed
2 b" E; R9 A# {+ S* h) y) gelse
9 O3 ]: T3 [1 D" W( T' gns_marquee.left=marqueewidth+8
8 N" w$ e6 I) p: f! n}
2 g; M3 w% Q5 ~. U9 P1 S}! m" I' Q/ M' M3 T# o/ i y
0 G( k; ?) o' Z5 h$ _/ c
if (iedom||document.layers){# W) H T7 |% b
with (document){
2 O/ ?0 F: ^7 t0 Ydocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
* z4 c0 N* [ lif (iedom){
! R' x5 i( c. y" owrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
. j/ Q+ M8 I; x! A9 W+ \write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
1 j# }3 ]3 d7 l6 C7 v, G9 gwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')- s' K& V; Y0 ?
write('</div>')) @7 d0 ?( t6 t( F" x$ {& @8 _
}( o( r0 U* h" |5 ^: K$ U+ R7 S2 R
else if (document.layers){% S! Q4 g3 M9 D% [0 h
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')1 R6 @1 r. N) H
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')3 \5 J7 z2 M6 i
write('</ilayer>')
% r& B9 |. H2 f}
6 J# T. q$ {( @) O1 W! rdocument.write('</td></table>')" c4 o& O+ I {% g& P3 ^* k
}
" G! Z" s. j: H' U}
) Y& \' l1 O) C* g# B, U( M0 n5 l. l</script> |
|