返回列表 发帖

网页之跑马灯文字特效

//修改宽度+ }& `  w  U3 i; r+ s6 K; R1 d
var marqueewidth=3006 x2 c: y/ |, x, j  S6 R$ A3 d8 l, [
//高度
+ P( t  {( |4 j( S2 yvar marqueeheight=25& F# i" \+ w0 o0 u; `% c$ R
//速度(1-10)" t: u& p  N" d, A$ ]* z* O
var marqueespeed=3- p3 U2 b# h0 [+ h
//背景颜色' |5 ~! q* R4 g1 m; ~2 w, w- {+ F
var marqueebgcolor="#FFFFFF"
+ u: \! B1 `) F//是否能暂停 (0=no. 1=yes)?+ \3 f. d8 n: H" z/ Q4 t# k  N
var pauseit=1
2 N. n# ^, S% ~  W' W# w2 z) s6 R" z
//修改显示内容
( B$ n; t1 n$ v7 y/ M* kvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
  Q! ?9 Q( e. |8 ^% @8 j
4 F! n0 L1 a# `) Q0 T$ r0 Q# C. o6 r( Z. ]7 ]( I0 c  I( T
////下面不需改变////////////1 _9 N! [5 g/ D+ @! D
: C) l8 S; A6 [
var copyspeed=marqueespeed1 ?1 M, q4 d- I* C. D
var pausespeed=(pauseit==0)? copyspeed: 0( E9 v2 q, `9 ]* s
var iedom=document.all||document.getElementById6 U/ L& I: a" \
if (iedom)3 q0 a9 `8 y; F, B
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')3 T- E. T9 H0 K+ r0 S
var actualwidth=''- [) a2 x) f7 A2 s' S
var cross_marquee, ns_marquee
9 \8 W6 h1 @7 N9 e6 O! g# `4 N! n7 R% f1 w
function populate(){
: N% ^! |1 p4 ~1 o' S- {. |if (iedom){4 x( r7 R: W- U/ ~$ E4 B
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee+ q5 p: z* g  E$ B6 A9 L
cross_marquee.style.left=marqueewidth+8
4 z" ^2 d1 g2 j2 j6 |) `, across_marquee.innerHTML=marqueecontent$ ]# z. a: K9 T
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
, T8 b6 [/ X0 ]1 |}
. F( g# V1 j8 f+ o, b5 M# Celse if (document.layers){
# x: G7 k! t, i& }/ Fns_marquee=document.ns_marquee.document.ns_marquee2# W4 N) V7 ]$ E0 y3 ]- ]. ~
ns_marquee.left=marqueewidth+8' T! I; a& w, o* p+ V9 k
ns_marquee.document.write(marqueecontent)
  e  Z- a  [" `3 q! I/ Tns_marquee.document.close()
* m1 S( K* \& @actualwidth=ns_marquee.document.width
! R2 X+ u- V- _$ t}, O3 ?" ]% {* @% p
lefttime=setInterval("scrollmarquee()",20)
7 b% R& q9 p7 C( v1 i}
+ W4 f5 x# Z# e3 {" ]3 K! h" d; k7 Iwindow.onload=populate
- z/ h$ s$ @7 W8 r. {
! }& W5 n3 B; h0 Q/ W! yfunction scrollmarquee(){
% W. W' a8 X# u: e9 B! gif (iedom){5 W: ]9 X0 [* r) e) }
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
! {& S$ R$ @# g1 \' i. K5 Xcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
: P1 }! L7 a! T/ S' U) S! ]else/ G  C% j4 [* `# A) F
cross_marquee.style.left=marqueewidth+8
! l  [$ _2 b. M
8 y3 E1 n- N3 \4 u: ^$ Z! X6 A9 E}0 h. S. p- d9 G+ X6 ~2 k
else if (document.layers){2 ^; g' A& f  O* j* B+ T
if (ns_marquee.left>(actualwidth*(-1)+8)), E9 Q& ]3 p2 X- _5 K
ns_marquee.left-=copyspeed9 T- \/ X$ E# y7 N
else7 i0 S8 ^  U; d$ x0 |3 y) D7 w% p  W
ns_marquee.left=marqueewidth+89 o0 ?" _3 C8 @3 L7 x% _4 I
}
5 Y3 N# U5 m* n$ Y6 y1 ~# x}6 }4 T$ {; k! ^) D: K' N
' A  v! J( [! q3 N
if (iedom||document.layers){, y& C  @# c3 b+ l
with (document){7 @# s$ H, p; k# b# R
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
$ A' l1 O! E* ^% a' `if (iedom){
% F  L/ O( E; U0 owrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
" E, B  j- x; T; @6 F, Qwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')+ R( k3 @' x4 _; h6 T% @" H
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
+ \1 W1 d* j1 X6 {8 swrite('</div>')" k* s' v( K$ v: C
}
+ `6 K: {! ]4 Relse if (document.layers){
4 m; ?! A; I* Q1 W& Gwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')4 b+ m; ~: a' w: D/ i8 j2 H8 I
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
6 t: L# U  e4 O3 {  [' Swrite('</ilayer>'). `7 w4 w/ C* S7 p3 T1 Y4 z
}
0 T+ ?* r. A+ h' E+ `2 q, `document.write('</td></table>')5 X+ a3 G% p0 T7 s' ~) b
}! k0 T# o9 H+ O6 l5 q" |
}
8 }1 {3 n& ^/ J4 D( L+ L2 d1 D</script>

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