|
  
- UID
- 133
- 帖子
- 51
- 精华
- 1
- 积分
- 186
- 金币
- 55
- 威望
- 2
- 贡献
- 0

|
网页之跑马灯文字特效
//修改宽度
7 e- `0 Q3 |5 w! o3 M) y/ }, C& Wvar marqueewidth=300
. w6 S* b% P" V//高度
/ D1 \) @# l5 k S. E6 t/ Yvar marqueeheight=252 V' ]8 C* h9 q k, P* Q# S1 B' {4 _
//速度(1-10)
+ L" U+ P0 @9 @0 j+ _var marqueespeed=3/ z2 x. [# Q b# s
//背景颜色+ B7 ^( y( ]3 |
var marqueebgcolor="#FFFFFF"% B9 X7 o) N$ ]* W1 c4 o
//是否能暂停 (0=no. 1=yes)?5 _2 c! ~) E7 u' o! B
var pauseit=1; X! @4 b( S; ~8 H* f$ E
# W2 [) n/ i$ k7 M$ B* k: f
//修改显示内容1 D3 v0 i" Q# s& ?/ V8 Y) D+ t
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
2 S. |8 I7 C' K6 P' h2 P; A `! N
- R( V. e. `) z7 k' a
& S) g: }: P; U////下面不需改变////////////
3 U A' V2 |8 c' W. S$ A4 N! B B+ v' C
var copyspeed=marqueespeed' F( l2 F5 s9 @0 r( C, X9 p
var pausespeed=(pauseit==0)? copyspeed: 01 C$ G" p! c7 ?9 `5 M0 t& R* t
var iedom=document.all||document.getElementById
5 G. w& p. I# c$ q7 O, \6 Tif (iedom)7 \6 R+ T6 u& `7 S' x
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'); F& y& X7 ]4 V) H9 M/ ^0 }
var actualwidth=''. T/ S0 E0 t) v- t9 {5 l
var cross_marquee, ns_marquee! t, R5 a% R6 y; Q% Q& `* y- e
3 n- h P9 t. N7 e3 \# D/ I
function populate(){7 u0 A, G3 }3 D+ U9 `# s, G$ ]4 D
if (iedom){
1 K/ j7 C. O3 f/ q# Vcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
+ ~' y; j6 [/ z$ ? Pcross_marquee.style.left=marqueewidth+83 c3 Y7 E" k9 D7 @6 x3 E
cross_marquee.innerHTML=marqueecontent- V7 Q3 m) Y" T% b
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth. K7 H2 H) ?- j) a- V
}6 S% U; N& g" R8 w3 T! H3 f0 v
else if (document.layers){( E* i, ~- t! H2 W9 b
ns_marquee=document.ns_marquee.document.ns_marquee2- A# T! _# z: B8 h" ?2 u
ns_marquee.left=marqueewidth+8
+ x) y) ~5 y' y" a, T& _ns_marquee.document.write(marqueecontent)1 F* w( b4 E% p- l# w
ns_marquee.document.close(), n* W( z9 C1 i, |
actualwidth=ns_marquee.document.width
9 z0 m. ~3 y- @( v7 ?: ^}5 }4 }$ f" m5 z1 J T1 E) Q0 K
lefttime=setInterval("scrollmarquee()",20)
4 K2 ~ c: F0 d# D* N}. [0 u. T, w; D$ w
window.onload=populate
9 [+ d# K1 k9 `8 R& [* O, G
9 D" b5 A$ n0 X! y+ d+ @# cfunction scrollmarquee(){
& n9 S. o: l d5 U D8 E# F$ Fif (iedom){
7 s% A; `" F3 k. Hif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))4 W0 M( W3 g( \. f2 R
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
. u! ]) k a# A$ I* ?. E2 b$ Oelse
9 W, U' x" Q( Ecross_marquee.style.left=marqueewidth+8
9 \. @+ I% V. t# ^
! B8 y& i6 ?$ d- D( h}
- d. \) _# E8 a: g, L0 O* J% I1 S# \else if (document.layers){
& v' L% D; \2 Iif (ns_marquee.left>(actualwidth*(-1)+8))- R) s9 i/ q: f8 |# G% V+ a
ns_marquee.left-=copyspeed
/ h1 T+ {: ^% l4 R. j! Helse/ {; ]9 Y2 n( H4 W4 B- ]7 k
ns_marquee.left=marqueewidth+8
3 U- N' h, _6 [/ |}# @+ n% v2 U1 P
}
& ^! y! V+ ~% Z) C/ x
6 b5 p3 l4 G2 V3 Nif (iedom||document.layers){
4 n& f( b/ k, f% u0 m( Fwith (document){
4 ]: y) k F' \document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')- i0 s2 h) f% A7 u1 g5 \
if (iedom){
# l: p' Y# a9 o( z# l) t1 z* R! owrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')' A$ i: Q8 W+ L
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
, G" @+ T* V. R4 lwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')! r5 ]% g' M( M4 c, {8 f
write('</div>')
# s0 c2 O5 v8 U4 E}
& A B+ k7 K* d, Felse if (document.layers){( N8 m$ G! U1 L& k8 [4 R0 K
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
& ]: d0 o" l* W& t6 c0 c! M& X6 N' _write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')3 k+ F7 f7 {9 \6 ?7 H- n
write('</ilayer>')
/ _0 t$ n* E. [3 J+ h g}: t- ?/ a- C5 V* ~- D3 f, R8 V. {
document.write('</td></table>')" Y+ F; B1 J5 { |
}2 q1 D' E5 a3 a, Q
}3 f E9 v7 o f# q2 S8 ^1 A5 N
</script> |
|