返回列表 发帖

网页之跑马灯文字特效

//修改宽度
+ P# t0 B8 W3 Svar marqueewidth=3003 K+ D, F' Z6 n. S; r( U  q
//高度
! r. m( H8 l6 p0 zvar marqueeheight=25
& s: ?5 j& T7 e, p' ?//速度(1-10)
( B& H3 f# f1 ]7 e- Y9 A6 |var marqueespeed=3  B1 J" K% s8 U" ^3 a% G( W& S
//背景颜色
& x" f* F( m+ l( ^var marqueebgcolor="#FFFFFF"5 O2 T6 X8 L4 ~. ?5 l7 H) a
//是否能暂停 (0=no. 1=yes)?
5 P. |! x  ?% kvar pauseit=1
2 a/ p% U( i* H: b- h$ `& P7 `3 ^4 T8 m+ Z8 z* h+ j0 T! [
//修改显示内容' a8 C1 d6 a1 E
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
$ z- m5 t* _! e' p) Z' R. k+ o$ N# [" y: {) v6 N
1 k6 q8 t; U# n0 t7 m  T4 X6 W
////下面不需改变////////////
; V' ?- ^) g  V+ F' Q3 ?8 x) O' v/ j* T( x" Z: h
var copyspeed=marqueespeed
0 T/ Q2 B8 B6 n# dvar pausespeed=(pauseit==0)? copyspeed: 0; }9 S- K- m( t( j. A0 ^
var iedom=document.all||document.getElementById
: i' j/ t  N) Oif (iedom)
! |( _& T! V& a( ?9 x& `0 @: sdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
5 n9 c' o. h0 {; A8 S  ]4 |2 k0 O1 dvar actualwidth=''
. M4 z$ z# y" D9 E2 q+ h; X9 i  `var cross_marquee, ns_marquee
/ N: S* d  Z6 R! E8 _# `: Z  n  t4 T  H  v+ y6 e3 w" K# u# @3 l
function populate(){
- g( }, ~% I5 v5 U% o* fif (iedom){
0 c- d7 F* `# L% m! R0 e7 ~cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
) U; e/ a- l6 S% c$ e5 Kcross_marquee.style.left=marqueewidth+8! l% m/ g3 U4 e* M8 q
cross_marquee.innerHTML=marqueecontent; }; k2 G) [+ L+ o% A' w
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth6 \" u/ [) z5 z: E2 R! t  w: d
}. k' Y& H" y1 g
else if (document.layers){
2 o7 B% y. W/ ^& Wns_marquee=document.ns_marquee.document.ns_marquee2" _! j% b4 u0 @6 C2 {' `: w1 o% I0 Q) K
ns_marquee.left=marqueewidth+8  D) a" ?; u8 [7 K
ns_marquee.document.write(marqueecontent)+ n* _9 d% L3 g: J
ns_marquee.document.close()
' d$ i" B4 l4 C2 k* L6 Zactualwidth=ns_marquee.document.width
9 Z! B; A! t9 B/ P}- L+ Y1 [0 `, ~6 q: ~8 f: P( L( U1 [
lefttime=setInterval("scrollmarquee()",20)
: h7 F/ p/ K2 b/ ~4 Q}2 @: U$ J3 S, d& ^# d$ D
window.onload=populate
+ t1 e, D7 k( [+ T' C! B$ [- q: ?: n. Z8 }- r5 S
function scrollmarquee(){9 b( V! r0 W* F4 m& D- b& B
if (iedom){
5 }; f  H! I2 G* V& _8 @- {* Gif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))! A# ~) B- `. T$ O0 r# K
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
0 N! v( y5 G% h0 d# S  Eelse; V, @/ R) [6 T9 k
cross_marquee.style.left=marqueewidth+83 |! ~6 u2 N3 F/ w8 X$ b7 |' g0 @
! c$ d& l5 p/ f4 {) ?
}
; o( H0 p7 L) p/ t+ Welse if (document.layers){
3 U# u- q9 J2 B" j6 Tif (ns_marquee.left>(actualwidth*(-1)+8))
. `/ y# _: `1 uns_marquee.left-=copyspeed
' e, y/ o9 q3 t% L5 nelse
& J# \9 a: J6 u0 P' ?/ Dns_marquee.left=marqueewidth+83 W: n- T& v- x2 [
}# v( |( ~* V& d* B/ P) {
}
3 d6 E' ]0 i, c. g8 [4 H! a  Q& [: _( N
if (iedom||document.layers){
. X, ^8 v! F$ Owith (document){
$ J8 V) B9 U9 B; V- rdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')8 l: b+ y2 T2 b% c
if (iedom){
( W$ `$ T2 y  U/ \( I$ A. `* |write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
1 z' ^+ A) @  D5 G+ Y5 K6 z  c. kwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
0 j7 f6 k  d) T9 }: Z! twrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')* a4 g6 U5 H2 S- a
write('</div>')5 Y- [9 l3 d# L1 ^% f
}
; C# G6 Y% l$ {% Ielse if (document.layers){
) I- v& k! R( {write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
/ h/ ?9 r3 u+ T! j- ]  f1 L- ~$ Bwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')" t+ K0 C" J8 N1 n- o
write('</ilayer>')! y0 s! @6 Y  n
}
8 Y# b$ a" e) X6 V+ S- Udocument.write('</td></table>')) b1 w$ v$ e* x4 `2 ]
}
2 D; ~5 c8 ?# @8 T. T  d1 }- T}
$ o8 W& ]+ x+ a& g# o) f- V) o</script>

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