返回列表 发帖

网页之跑马灯文字特效

//修改宽度
: V: l9 g1 H2 M( _0 a5 m$ c4 [& Lvar marqueewidth=300/ ]# }% h% a3 J  d! ]
//高度
5 \2 Z' A6 t5 V5 K* {$ G+ T; X/ @3 Xvar marqueeheight=25
& S, V4 q# \7 |& q//速度(1-10)
  y5 D; b0 _6 V2 A6 Cvar marqueespeed=38 m, `2 r* Y5 p9 ~( ^9 o& d/ c& l$ G
//背景颜色
2 V, x( X1 o: R) M9 I3 Mvar marqueebgcolor="#FFFFFF"
4 P- C) t9 A; O5 j8 `0 e//是否能暂停 (0=no. 1=yes)?
% }$ l7 Z9 ?' T( Evar pauseit=1) j1 C3 Q; L7 H- f
. A- }4 p( R  H' t3 N& _* W& K. y" b
//修改显示内容
9 e. d* r( l2 _: M0 p& B; v3 W% Zvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
( N5 U2 B8 e/ U/ R+ r9 y- ^- D6 B, V0 J/ _

1 @0 r  C7 B  C: }: a+ W////下面不需改变////////////5 u& a: t+ _" q: M4 B
* r5 F( V( {# m8 `5 |) f1 P
var copyspeed=marqueespeed
9 y+ C9 q8 w5 h* M9 m* T' i# Yvar pausespeed=(pauseit==0)? copyspeed: 08 C5 l. g# a& t' w( {- n
var iedom=document.all||document.getElementById$ H3 o& \3 H" q# B
if (iedom)2 d: c! k7 X' F7 n+ z
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')# ~4 T" s% m: N& u4 X
var actualwidth=''
$ k, E& v9 {) d, h/ kvar cross_marquee, ns_marquee* ~  Q8 N9 N0 T" ~* E9 J. `
8 w; h: w' ]5 Q; w7 z
function populate(){
- c. p% d- f. G# j2 X& X, U/ ^if (iedom){9 h2 j4 L1 Q9 U, Q6 t* E
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee  O$ }0 |; d+ @9 Y! U
cross_marquee.style.left=marqueewidth+8
3 T# r" P, H9 j* i( H" Ccross_marquee.innerHTML=marqueecontent8 m: I6 M6 v8 z9 R
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
3 \) S2 r. b0 p- u}
# o' p# i6 ~3 e3 H6 oelse if (document.layers){
6 j. _1 J) q; zns_marquee=document.ns_marquee.document.ns_marquee2- ^; f+ K- o" p( f3 e* p
ns_marquee.left=marqueewidth+8. A% w# M8 `- h5 a
ns_marquee.document.write(marqueecontent)* [7 ^7 Z# f- g) W2 x
ns_marquee.document.close()
* |8 b+ q; A! hactualwidth=ns_marquee.document.width
2 {1 W. p5 z8 o6 J* J% M* w" y}: K8 T4 ?( f) j( O
lefttime=setInterval("scrollmarquee()",20)* v! A6 U& V3 a) n+ {
}* d3 Z3 d0 @$ r
window.onload=populate
+ v$ r; ?! E2 G! g. I
5 K- D, A' }* \/ F: Kfunction scrollmarquee(){
6 M' D* H, T$ d: v6 c' dif (iedom){
' |- u, H/ `* b! {! l1 R0 y/ K! Jif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))5 E+ Q2 P: I7 t3 e
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed, C8 ?7 [& i1 j2 d/ h  n7 a, n7 I
else' B# x$ B/ i2 o* K- K2 f9 B1 N
cross_marquee.style.left=marqueewidth+8
! l5 t4 T) C" A
7 d( f2 {' U; K2 @3 A4 h* w$ Y}6 N, t  h! d  L; _5 l3 e8 M- E* G1 i
else if (document.layers){
. f/ o5 _; s0 ?% S: ]+ e) W/ Fif (ns_marquee.left>(actualwidth*(-1)+8))
% g! Z. Z9 j5 _1 X! H; t8 _/ ens_marquee.left-=copyspeed! g: n/ I6 s+ q- [* p+ `
else
& \" Z, l) `5 G( qns_marquee.left=marqueewidth+8
3 _; X- N( Y& R* D. s' m# t}) ]0 c3 t  A- i/ }
}
* B% C9 P, N7 K" A/ n  N5 ?. A+ R! |; i# h  [/ [. M& S4 f  ^. Y: t
if (iedom||document.layers){6 h' d0 A7 X8 o5 R
with (document){
" g' Q1 @; }( E% @document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')6 m( k% a0 @! O; p
if (iedom){
" A: T0 a9 o: Q2 Cwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')' U5 L4 g  P1 D% C% ]+ e/ i
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'). ^& t, v  d0 z; K/ k
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')' S/ Z. H+ V+ x4 X! _; Z( K
write('</div>')
4 v  I/ F' ^8 W) {}: s9 j1 d% H) L" c4 N
else if (document.layers){  ^" M* A6 s6 E5 W- Z5 W. W
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
2 e; w; N3 g4 t' @0 _1 S4 Y" M. vwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
0 o9 f1 Z. @, M0 d5 Q0 Owrite('</ilayer>')
' t- ]9 m5 j, d. `, N. V" t. ^}
- ~) m: ?8 d- Qdocument.write('</td></table>')" B- X4 W7 e) n$ O+ o/ T# g# _5 k
}
: V0 y1 Q# e: \/ l: b) s4 l}
  [* z) |+ ], P+ o7 d</script>

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