返回列表 发帖

网页之跑马灯文字特效

//修改宽度
* Q0 f5 O! F/ h" `var marqueewidth=300
- v) p8 T6 S" B$ D- Q0 {//高度
4 S, [# [& D& u& y2 @! {) Z6 |/ Y' @4 Avar marqueeheight=255 a1 f6 V6 y# ~2 t7 T  f+ K1 H$ m
//速度(1-10)( I3 Q5 n3 [' o# o4 Q
var marqueespeed=3
: l5 N; j/ j* c  j) ^//背景颜色2 K0 F- g5 N4 u' l) m  U
var marqueebgcolor="#FFFFFF"
* F+ d7 G- z8 x5 J8 z6 [3 n1 f//是否能暂停 (0=no. 1=yes)?
% e! A" X) p' L" U! lvar pauseit=12 z2 ]; u5 Z+ a9 O

* @# ?" T! E' ]//修改显示内容- B; |5 t) |5 Y! e3 ^# m
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'* b9 M. i# l5 g( t. ?

( r) V) T" n- A- d: k0 Q4 q
& f0 N, ~3 n0 q( d! }////下面不需改变////////////
, J2 N& R2 W8 H3 d+ [3 F. c' E4 d" f# y# g2 X3 n
var copyspeed=marqueespeed
1 g0 k" j3 H+ W0 |var pausespeed=(pauseit==0)? copyspeed: 0
* o: S- Q- O- Z6 U" J" f9 gvar iedom=document.all||document.getElementById0 K$ `0 i8 j. A6 m# p/ x. ?4 y) y8 c
if (iedom)/ S: Q' Z5 l6 X1 y) c* c- a
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'); k* S! o/ [: v& Q9 U3 n' l9 J
var actualwidth=''
; }2 a' o! @, [$ ]& {var cross_marquee, ns_marquee
3 A0 `1 K! G$ c. e& A9 p/ U+ F3 J- L  O0 u6 t
function populate(){& x7 v* K. Q7 g$ M% u- W! R+ ?! k
if (iedom){! f6 N- x! b: Z5 p0 _
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee9 F6 u& Q# b* w& g3 Y
cross_marquee.style.left=marqueewidth+8
# `' E! t: v" _( c6 M& Xcross_marquee.innerHTML=marqueecontent# q2 ]# w# K/ r) n3 J
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
+ q1 L: S) T5 P# _& b}  ^6 l4 p7 m6 h- `! l& w1 a) m- |* L
else if (document.layers){% a  X  f: @8 g$ P0 A/ z9 {9 V2 p8 Z, w
ns_marquee=document.ns_marquee.document.ns_marquee2
& O+ S6 |1 t) P0 k2 e# |, }0 |ns_marquee.left=marqueewidth+8
1 ^% d3 k9 V/ c0 y: B+ X4 Xns_marquee.document.write(marqueecontent)
) j  t/ C& X1 ~0 b; P: Ons_marquee.document.close()! P2 G& m, R+ L9 F5 a) |; R
actualwidth=ns_marquee.document.width
- R1 D7 I1 F" x}+ J$ P2 h4 v* [5 |7 a+ |
lefttime=setInterval("scrollmarquee()",20)
8 [' d; u' C& K$ E1 t& h! m}& E0 r& ]7 l1 L5 K; O0 _/ a
window.onload=populate
- i/ m3 c# [5 Z  J% D, {5 |+ n/ M" Z2 E& p
function scrollmarquee(){
. D  s8 C, I" o- y$ _# Aif (iedom){
2 m) M" ?5 l5 N. {4 Oif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
9 N* G& |1 A/ {  f; }cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed2 A' }8 {  D2 ~/ P$ P$ _* s' n) Q
else% p0 j0 \8 `  b, o
cross_marquee.style.left=marqueewidth+81 t2 n' u  ]0 ~" F0 X( h
. n9 b& k* l3 r7 M
}9 `- k& X- Q# g  v+ s9 j
else if (document.layers){
; `! E! d7 @5 k5 C7 t" M/ {if (ns_marquee.left>(actualwidth*(-1)+8))4 n) L8 b3 b, r5 M* s
ns_marquee.left-=copyspeed- C( a& i/ P7 S
else
4 B2 O' n, d5 P9 d7 v2 Lns_marquee.left=marqueewidth+8. ^1 G0 ?1 `' l9 ^. P& C* ~
}
# L) F3 f1 w# ?. U  Q7 Y1 ?+ e9 ]}- ~1 V  V* M# p  o, r6 p

6 |6 d4 c! e( p9 g5 V( ^: ~2 M  Qif (iedom||document.layers){
. H; w8 b+ ?$ Z4 U; }) wwith (document){
' q, @, ~5 a# r: F1 C% `: `! Mdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
8 k8 n; Q+ z$ s9 t  O- ^if (iedom){
# E/ P% b& }5 dwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
7 t3 V+ J) k$ V8 B* n0 i- swrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')$ ?7 \; L' u6 Y! `9 J5 T7 f
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'), ]4 y; L1 m# Y4 \
write('</div>')) Y# c7 x1 r' m: ~. q
}- x2 z! _( \3 Y% c. P! q9 t7 T& f
else if (document.layers){, f, f9 j* y$ g$ Z+ w
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')/ \& L& p& l4 ]$ Q+ `3 I1 `  |
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
' N* Z; c& o& R& w5 D" _write('</ilayer>')1 ?( V, l& S0 M0 ]
}9 I$ s* X- _% m) [3 I7 Z+ X
document.write('</td></table>'), k6 |9 f5 q0 ~9 e! ~% o
}$ q: L4 D; Z2 |+ ^$ k
}
/ L; y' e; S$ }$ [</script>

返回列表
【捌玖网络】已经运行: