返回列表 发帖

网页之跑马灯文字特效

//修改宽度$ a3 W% U3 d" L( K4 z1 r
var marqueewidth=300
+ q0 A3 ]$ H9 M- v" C5 }//高度
: S3 C0 q8 {* `* |* D' Y$ j3 Hvar marqueeheight=25% a( T7 H" X9 q3 Y* h8 N
//速度(1-10)) s7 T5 L& p; k0 e
var marqueespeed=3$ @4 k" y+ n9 U$ o$ J. ^
//背景颜色
6 l4 q* D3 x: U& j3 wvar marqueebgcolor="#FFFFFF"
) `5 z2 }1 k* O$ B//是否能暂停 (0=no. 1=yes)?; ^- r5 Y7 y! O2 `8 ^& ?0 z" s
var pauseit=1
+ W; f* P6 }3 H* o- d6 P
- ~& E$ P2 G: Z//修改显示内容+ ^$ L; t: \5 s9 w& \. [2 P4 P
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'" ?+ H) z& B" u# G

- a, s$ Q' w; s# f: |$ }
+ Z$ v  p3 K4 u////下面不需改变///////////// h( t# I7 ]; F
8 j# @( M+ a2 E0 a7 o/ x6 ^! O
var copyspeed=marqueespeed7 x" W  S( T( y" H
var pausespeed=(pauseit==0)? copyspeed: 06 K. ]: ?* [% `2 Y6 D% \* ~
var iedom=document.all||document.getElementById
2 R7 F6 \# F" L# @if (iedom)% N- B  t) U9 B/ j
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')) |( k7 x; S$ X7 ]( u/ p3 e
var actualwidth=''! ]/ A' C; t5 X& D
var cross_marquee, ns_marquee
1 w$ {% [, j0 Y( A4 E& W5 L' J
5 P! s* P9 c' s3 n+ R6 f, Sfunction populate(){
4 {; w, B* Q" g6 G& Y: G# `if (iedom){' R5 a9 f! ^" S- P
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
  B" {& X  G( l0 W5 |! ccross_marquee.style.left=marqueewidth+88 B3 {* l: |/ p! K3 t5 `; z
cross_marquee.innerHTML=marqueecontent2 u- ^4 r9 o$ Z
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
* ?$ {* a# E$ S1 Q}+ m  e* F" v* y
else if (document.layers){
  t8 [7 U3 e6 N' z, Q4 o2 |! h: Xns_marquee=document.ns_marquee.document.ns_marquee2; w8 h. ?/ }2 o' g
ns_marquee.left=marqueewidth+80 w3 D* ]! X, N" x8 T
ns_marquee.document.write(marqueecontent)
1 Q8 e" \& p2 d; uns_marquee.document.close()
) i9 }$ r9 i" E& [( b5 |actualwidth=ns_marquee.document.width
5 m0 m1 W1 f# c3 A& _# v/ t! l, U/ s}; b* X6 g6 t2 R9 U( {3 h
lefttime=setInterval("scrollmarquee()",20)& n* R, `7 u1 e1 n% R& P* p3 H
}
7 a8 V: H, Q& Xwindow.onload=populate7 d4 M3 l. @) j1 u& P
5 a, F, i/ A- P( x; u
function scrollmarquee(){
- U4 i4 S, K8 a/ v8 |if (iedom){
2 I# {1 H/ z8 [% R+ h; V7 t. E2 K8 u! |if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))8 z4 ?( R4 D' m7 l5 L3 D
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
0 B3 C2 X# S; U( u0 x8 @3 qelse
- W* l# |, J# k7 \& ccross_marquee.style.left=marqueewidth+82 L0 Q/ ^; X2 m) s( E1 V0 U
1 x$ [0 q  g* h/ g
}
' D  u, [$ b" G" F6 m4 melse if (document.layers){' h  o: k/ |  h" R4 @; M- `% v
if (ns_marquee.left>(actualwidth*(-1)+8))4 B0 @- b- f: I6 f
ns_marquee.left-=copyspeed  o$ R6 @* z7 |* F
else
: B: r5 J8 C* v9 hns_marquee.left=marqueewidth+8/ V" Q0 M8 |/ [8 @1 Z* F5 X8 I
}
- b5 a  B: `- g; A}- H2 k" m4 T7 {; }8 k
# ^3 f, b+ p( z$ _
if (iedom||document.layers){
4 I6 I- l- [. |; X: I5 Awith (document){
! ~2 V( s1 M8 i( w/ v7 c- c  gdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')( U2 z" N. j. [  Z
if (iedom){
, u0 L( z& s" iwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
0 Y$ a, B. I  j1 u# ]) X+ Nwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
  ?7 `! @5 Y0 k* X+ Kwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
6 P0 }3 F& w0 s: n7 i& A- l* rwrite('</div>')6 O  w& a8 ~) x# b# y: J5 a
}& k; E2 c  P! Y3 t: ?2 K
else if (document.layers){
4 Z7 i2 G2 l/ f$ x' S( T9 `2 a. W8 |write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')  i0 f0 v4 d" p) w& U& I
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
5 L  k/ ?; l1 F9 z; r- G- Bwrite('</ilayer>'), j' t7 Y% E( ^: K
}
/ p* @) Z0 Q3 I* i  Ldocument.write('</td></table>')
8 n1 p' I, F8 l( W$ H}
# z; D8 A2 Q' ?; m$ w}
) q/ `# B, ?( n. Z7 |" G</script>

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