返回列表 发帖

网页之跑马灯文字特效

//修改宽度
* @8 [! S& i# g% n/ x* pvar marqueewidth=3001 [5 |6 V  Z. }$ I% @6 k
//高度
1 y- b: m5 R7 wvar marqueeheight=25
7 c* s' j. M. P1 p//速度(1-10)
5 I4 ^* F5 a3 [( ], |$ \4 j2 P, J  yvar marqueespeed=3' H4 k: z' p+ \8 Y( j
//背景颜色
- Z1 n1 m$ [  C+ k+ o: e  e& r9 h; `var marqueebgcolor="#FFFFFF"+ F4 z; r7 @9 c  Q
//是否能暂停 (0=no. 1=yes)?) f- y, y# [0 z+ ~3 w& x9 \: @1 p' d) O
var pauseit=1
6 ^: V- R9 C( |
; i% F6 I3 z. n1 S8 l1 {# D//修改显示内容
: N1 u1 z7 C$ t* q8 r0 mvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
6 l7 T% y7 Z. H# O
# a  [9 G9 v+ `* c$ T; y7 ^
4 [: ]$ W/ f% w0 A4 O////下面不需改变////////////
/ y* s5 i$ r) `4 e0 J/ e1 s% J
; v( _0 v( s- O0 t) y' w  `$ Qvar copyspeed=marqueespeed
1 ^- |6 `4 i7 S+ gvar pausespeed=(pauseit==0)? copyspeed: 0
1 W  H9 s6 R% @' \$ L+ r6 W+ Bvar iedom=document.all||document.getElementById
2 O: T4 V+ X9 \1 zif (iedom)! u, {1 s1 Q" N5 O' ~) d' [0 b. k! z% m
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')6 f$ H8 i" R% X9 ]
var actualwidth=''
0 f+ u3 b2 H' ~0 G, z' Y' G0 tvar cross_marquee, ns_marquee/ r0 ]: K. c; X1 `5 w* E; W9 m

2 t7 B& c4 Q& b* T) W4 t4 kfunction populate(){! \0 m) U8 r: ^6 h, I
if (iedom){
6 d4 x( @3 e& `$ Ccross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
3 B. _2 x* B) f- [6 [3 _$ Y1 ocross_marquee.style.left=marqueewidth+8
( W# f9 D. V- }7 [cross_marquee.innerHTML=marqueecontent
0 j- Z( u; t9 d8 O+ l  Cactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth( H6 Q" O! e3 p, _4 e
}. h4 ]6 N* G9 j# A+ g
else if (document.layers){
1 T+ n' P1 `1 W" ]ns_marquee=document.ns_marquee.document.ns_marquee2
" }5 Y) h! m  \; V$ x9 ons_marquee.left=marqueewidth+8
! ^" m7 F* e3 s( t- ]/ _9 }  ins_marquee.document.write(marqueecontent)
. O! n% X: n! x- J% f' Rns_marquee.document.close()! n  ~. X/ n) h+ ?0 J4 g
actualwidth=ns_marquee.document.width
2 j* U. U) f: ]/ g$ O0 E}
7 W& V" R$ x/ l, B2 r) K4 J- Elefttime=setInterval("scrollmarquee()",20)
8 M) F% N& w$ h( B3 E3 `( y}
& B& F! S6 \# W$ |$ q) J: q$ Owindow.onload=populate  z/ y: M" @* y, s  q
; I; h6 u1 w4 p/ K, X2 Z
function scrollmarquee(){3 {+ E, E# R* x4 o. o' X
if (iedom){
2 K% Z" |9 E2 X+ |6 W: Sif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
9 S& `% C% h. U' y6 Zcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed* W  L" U& W+ d( y4 c  [
else
2 W, k4 `" a9 i' F) @cross_marquee.style.left=marqueewidth+8; L% N3 P* a' E3 s7 }" \
3 f" S: F/ R, v5 I
}1 J" G9 m! _- Q7 y6 H# x  C( I
else if (document.layers){
& ~3 H8 Y- v4 x* S6 N' d. X: k# tif (ns_marquee.left>(actualwidth*(-1)+8))! D1 [4 `1 m* D( Q8 Z) E/ _. o& V
ns_marquee.left-=copyspeed' F- S/ ]+ b: e0 ]0 N4 S
else
8 ]( X* A7 n: }! F7 O2 R( r( ons_marquee.left=marqueewidth+83 m5 f- J3 ?& b
}
' L% r$ F% \- \1 S' o8 P/ a}
, D; l6 Q$ m1 w+ Q" e$ i* ?8 U
. t# c! K/ x+ m3 _if (iedom||document.layers){
( ?$ G7 [2 r7 J" Vwith (document){
/ t" J7 K+ S( \document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
- U8 u% Y1 |3 \: j+ S; Pif (iedom){
; C. M4 ~- q) J* L3 p8 [6 A; H1 wwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
# P, f6 f0 V* r# d; a4 fwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
1 O8 T0 I/ f& Mwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'): t* W, F0 I! k% ]0 E
write('</div>')0 [: ]4 V: ~% x1 V4 k0 A
}
3 r# ]9 x. S/ @- Aelse if (document.layers){' b$ L( B( e  g
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
$ K, _! I: R/ ]7 U( @write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')( M1 L" V6 q1 y* e5 _; O5 P
write('</ilayer>')8 I: R- n6 z5 x' I5 q- i" N
}! x/ {: M7 }4 r& H: q5 B8 k: ]% g
document.write('</td></table>')  z4 q2 z, p5 }2 _
}
9 b2 [( U( {5 V! G/ I) m}" k+ Z! g, o' S3 w
</script>

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