返回列表 发帖

网页之跑马灯文字特效

//修改宽度
, L- h7 Q! F6 l1 W6 g( Ivar marqueewidth=300
5 o3 H. r0 P6 g4 D! |* i1 O//高度
% F2 e! \$ V) ?% Z$ }; \) fvar marqueeheight=25: n8 u* l  @/ Y. E* U. Q
//速度(1-10)
8 v- D: F! g3 s. |, x! U) xvar marqueespeed=3
3 @+ a9 a& y/ j) n* Z+ g, f  O//背景颜色+ Y; a9 R( c+ ~2 H3 N+ l$ Z  d" I
var marqueebgcolor="#FFFFFF"
+ q4 J: W. L- W4 O$ R$ Y//是否能暂停 (0=no. 1=yes)?% ^1 q; E! b4 n$ h$ N' _( J
var pauseit=1
% @% ^7 }* H8 k  l6 b: ~& F5 e" m5 e7 ?- ?9 P% J- Q
//修改显示内容  u  c( W4 Z0 }% b/ O; M
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'0 x1 w- ]8 n/ ^1 m3 ~- j. ?/ }/ L

* A* m8 Z5 K% T9 u; o
9 _: [7 u2 Y0 N- a& r1 C3 {////下面不需改变////////////2 I6 E& R: D6 @1 e
) n, p9 M9 D7 n7 m: t9 ~
var copyspeed=marqueespeed! o. H( o# B0 n: d, v) [
var pausespeed=(pauseit==0)? copyspeed: 0
! k. k4 ~2 q) I# E1 a: \1 v3 D+ }var iedom=document.all||document.getElementById# W! M" K$ V+ L% l, n
if (iedom); r9 W" ?8 F& l- n/ ?' P6 f; X
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')3 Q+ ~3 ]& b4 u/ Q* @
var actualwidth=''
9 v7 A( W' t$ w8 {var cross_marquee, ns_marquee
. h2 a8 e7 L+ a4 y9 j! A! W  ?) I
9 G7 o& [, r; i& Q9 @function populate(){( M, f7 K- l, E9 m7 z
if (iedom){
, u7 X0 E/ I8 L: @6 \cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee( z+ ]/ C& T0 X: _, w
cross_marquee.style.left=marqueewidth+8
( P2 L0 }5 j9 U* A0 mcross_marquee.innerHTML=marqueecontent* p9 \, G) F2 ^/ H7 |* z
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth  ~$ b) p2 y7 g7 l8 R
}# y, W, i8 B% N7 W  Z* w" w/ B
else if (document.layers){. v6 ?5 @5 k1 G
ns_marquee=document.ns_marquee.document.ns_marquee2$ F/ @% ~6 ^/ @8 G0 a9 |  G! z  q
ns_marquee.left=marqueewidth+8
, k( [2 o. |5 x% O0 E: a; A* N, Tns_marquee.document.write(marqueecontent)
) {; v1 N+ r; z9 ^ns_marquee.document.close()3 s  M9 T  i, H  B" O1 B* {
actualwidth=ns_marquee.document.width( B- F) X2 T9 d2 ~' \7 J8 C  f
}* \/ H. ^' g& A
lefttime=setInterval("scrollmarquee()",20)
6 Y6 t: I6 a: l( M- e2 r1 r8 ~* I0 s}- [$ k1 l) n) N+ G
window.onload=populate3 G+ W2 g3 f7 ~" K6 {0 A
( l- b/ P! K5 n; ]5 N+ S
function scrollmarquee(){
% J6 Z$ y0 ~% jif (iedom){
% P; z) e- F$ |if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))+ t: s7 z- `0 V
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed' `1 w; @" S1 V" h
else
2 P( X8 X) r4 T5 Kcross_marquee.style.left=marqueewidth+8  f# `$ p. h: E3 n1 }8 w1 D

4 e5 R# G) f" X; ^( H) H}
0 ^. g$ S2 C4 O0 {; u: m4 A7 aelse if (document.layers){7 o6 l; i! Y5 B6 a3 r' M, E* z& D
if (ns_marquee.left>(actualwidth*(-1)+8))
+ e, l& f, f* G4 Wns_marquee.left-=copyspeed( e/ {. t: V8 D  E8 T/ O
else
5 z# ?' a1 S& p4 J8 s* `ns_marquee.left=marqueewidth+8
% a2 y7 m3 w2 e; f0 I" N' t}' J- M! h% x0 U9 p
}0 O. H5 m9 {1 D! G% |+ d

+ L: w# a1 k" S  c( J8 uif (iedom||document.layers){
. ]7 w$ I* `, R* G; ^with (document){
" d% B! X( d9 h  t/ [- x) P; f% tdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
4 O) }- i  X' mif (iedom){  K: A4 ^: a* B2 a
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
" T& f; m* y: d2 Q: N8 Qwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
! b& n0 D3 g. h% g0 Q( wwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
3 o" p2 j  e3 e8 D+ fwrite('</div>')' F+ e' W- y3 q0 V
}
( u1 T2 E7 h: Q' eelse if (document.layers){
: ~# h; w: F! A/ D7 I8 F; Dwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
4 d# Z- r( ~/ k! \. U! Dwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
- M! z% W1 k6 o5 D% O1 dwrite('</ilayer>')6 _* @! M, V; p9 `
}
& b2 L/ T+ s; [0 H4 A! S7 Ddocument.write('</td></table>')
! z! o* L4 m- L+ [$ i}; Z8 A( A+ r' ^  k
}
1 @; ?7 J% _. \( R: ]</script>

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