返回列表 发帖

网页之跑马灯文字特效

//修改宽度' f4 q1 q$ j) J- G9 I
var marqueewidth=3001 N  M6 I4 d# T2 E6 {- q% J
//高度) O# f7 i. i( V. V; c) i
var marqueeheight=25( ^, }5 ^5 O5 |. {5 b
//速度(1-10)
! R) C( \2 l4 l: Vvar marqueespeed=3
# u, ~. y! X: _//背景颜色" x0 \2 l& y* u1 E: b$ Z
var marqueebgcolor="#FFFFFF"+ L3 `" n% Z8 D* B4 {6 R
//是否能暂停 (0=no. 1=yes)?
& q: k( Z  ^6 [8 X  evar pauseit=1
+ f% L- @& _: G; b) O* E
+ r4 D2 A' O9 `0 X, z4 U6 A//修改显示内容
. B& g) |' d' q( V, u5 V4 lvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'2 B) _1 j* M4 A7 m* i
; |  t/ I" y- b  G: a

: u$ h. i' z, r$ ^////下面不需改变////////////3 d1 Y: O2 V: U% k% U
, }6 Y; L( ?) d
var copyspeed=marqueespeed
: x8 `# @# I- A* T3 O. c% J% k4 O! rvar pausespeed=(pauseit==0)? copyspeed: 0
' u8 u! q* w' Gvar iedom=document.all||document.getElementById" E2 i/ j+ i, Q$ A
if (iedom)
3 w. [5 m! N! B2 k+ Ndocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
, Z. m' f. H! P9 Uvar actualwidth=''4 {; a9 {; ~$ s& E" v
var cross_marquee, ns_marquee
. y0 t/ V" Z0 j- a" B* F& l0 J( Z$ |# E: t" {/ y
function populate(){
# L8 S8 `& E/ Y% b! R* Vif (iedom){
& [! [3 `9 `- `8 ~3 qcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee) I# m/ P, O9 \$ m2 g+ }
cross_marquee.style.left=marqueewidth+85 A) d: P6 O& g# Y% ?
cross_marquee.innerHTML=marqueecontent" V9 X4 q/ p2 a+ j1 z) `
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth; C5 c1 n- d; P9 @5 I; u7 G
}- Z# H) j; ?. d" D7 h
else if (document.layers){7 d% _, |6 x5 S0 }1 }9 @+ l% l
ns_marquee=document.ns_marquee.document.ns_marquee2' z8 o* i8 Z7 O( v0 {. t
ns_marquee.left=marqueewidth+87 g- S  q- W1 r* [
ns_marquee.document.write(marqueecontent)% }4 X" y2 Y7 f6 T
ns_marquee.document.close()' o/ F% i- q* l# X* l
actualwidth=ns_marquee.document.width
7 k' H5 h2 G) ~  a& s}
. L0 k% c1 ^; L4 f% Clefttime=setInterval("scrollmarquee()",20)
% a: V' P$ t; N& l}( v" D. V0 ^0 ?7 l% d. w
window.onload=populate$ E' c4 h1 X# B# n

7 N+ b  R$ R  H+ w/ ~% qfunction scrollmarquee(){
% _' V3 s; w6 o3 x+ F& o, Sif (iedom){
% j' n$ n/ L" f/ X: ^' q: Zif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)); ?0 D# }/ K) |* \3 O  k7 F
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed4 k( \- |1 H4 K# ~
else
0 I6 }3 \! D) l- V& r- F3 Ycross_marquee.style.left=marqueewidth+8
/ ]5 f1 n# }  E6 g; j6 b/ p1 O) @% X8 b; L5 E/ B/ T
}
3 T, R7 v( f: H2 xelse if (document.layers){$ F% u2 w% ?; {  R
if (ns_marquee.left>(actualwidth*(-1)+8))
3 T! b+ R$ D5 ?) Jns_marquee.left-=copyspeed+ N, O7 u9 [7 i1 D& u
else: Z; k; w' F( [
ns_marquee.left=marqueewidth+8( M: g& l5 O% h6 P- f/ C; ]$ U
}% V* N+ [3 J) B8 F0 |
}# L, ~6 E+ _; J6 ~

: x, }) N1 j/ |: ]' ]4 Q+ `5 [if (iedom||document.layers){
/ j5 j) c; {0 U0 u( s0 L; r- T7 Pwith (document){, j. M9 `7 S, u" L$ ^9 C
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
# }! z+ G# Q/ I: ?! q8 X2 v5 aif (iedom){
( E$ m1 E6 @4 B. cwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
  x% E. W' P$ X1 I% n) d2 B1 K3 jwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'): h: v2 \" N. r5 x  Z; F/ c2 K4 m9 \. l
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
& F4 q# S* d4 Z' z7 O- ^write('</div>')$ P! X8 B1 x, H2 e1 E/ m, F
}
/ @4 w6 e7 T: a8 delse if (document.layers){
# V& z  U! D5 A6 _+ ~# Rwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
! ~' g& _! _$ A. C( Gwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')5 b9 h$ N3 c# {8 A1 c) ^# }
write('</ilayer>')
2 f% c$ V& a) Q& D}' A* g0 B# w; x
document.write('</td></table>')# b/ i5 w' x' N- L1 K& \8 r/ q7 k
}1 K* u! p9 A* @8 m& h! ^3 `/ t
}& i4 a& `1 p* u6 ^9 o
</script>

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