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

|
网页之跑马灯文字特效
//修改宽度0 n" C1 j+ _: Z2 ]2 Q
var marqueewidth=300( F" C% z3 C/ L
//高度# d4 }0 O0 V& O9 V! u
var marqueeheight=25
/ |0 |) h9 D- B1 I//速度(1-10)
$ b# v7 a$ U( h {9 Lvar marqueespeed=3# `5 Y$ v+ g$ b3 b+ W d
//背景颜色
7 ]. z: q0 y0 Svar marqueebgcolor="#FFFFFF"2 G4 S U3 f; D" A3 s* G
//是否能暂停 (0=no. 1=yes)?' _) z6 p/ a- W. n& p
var pauseit=1
5 D0 K# v: u" c; ?% D/ \& f- d, I o: {
//修改显示内容
+ `3 ~# y6 H3 s; U) Uvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'/ r; `& W: A- q
& Z5 R C4 }5 a; K! g
$ H* e: I; P4 x9 I////下面不需改变////////////
2 I/ e# T- c5 ~' f5 a4 @% c$ Z, A9 o/ J( ^& }# B
var copyspeed=marqueespeed- j4 g w: S" {
var pausespeed=(pauseit==0)? copyspeed: 0! b; u$ w2 Y$ f2 }7 N
var iedom=document.all||document.getElementById
$ r/ F. E9 E7 ?6 |if (iedom)
) n" I5 J6 p( r: D. Jdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
% }8 \- |/ p, H2 L& T; t3 ]' Z, i5 dvar actualwidth=''
: {! ?9 b/ \% Qvar cross_marquee, ns_marquee
7 F* t" k, I2 {: k) J# q# P0 s- H0 V6 ]5 D3 N2 j# V
function populate(){
4 R" D8 l2 h3 Y& Q( ~, ~if (iedom){# T0 P1 N% h7 ?( p) z E7 Y ?& f H
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
! Q- C; D) I7 ]8 i0 ]2 h2 p- Ecross_marquee.style.left=marqueewidth+8
! [$ q0 Y: @ M+ ncross_marquee.innerHTML=marqueecontent0 j# f! p" U4 g" y8 e; Z* o1 O
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth7 r' V- u& ]% M' ~7 i; u1 @
}
/ ~; Z1 B% |' r, H# Jelse if (document.layers){/ l% ~0 a' F. g6 y' j1 Z" @
ns_marquee=document.ns_marquee.document.ns_marquee2
6 P" Z% B+ E- D! h+ R7 ^ns_marquee.left=marqueewidth+8" R( {8 p# u' f2 l8 V6 i& a
ns_marquee.document.write(marqueecontent)0 q2 M' L' h* {+ c! [. e9 C
ns_marquee.document.close()! ^3 r; B7 X' O% j7 X, {
actualwidth=ns_marquee.document.width
+ C! J' G0 ]) ~$ m- n l+ f! G; N7 c}
( e2 O4 I0 @$ P8 L6 L8 |lefttime=setInterval("scrollmarquee()",20)
6 g+ ^; Z3 x/ |! R6 M% d1 Y( h$ W}: l6 ?5 x# Z/ J U
window.onload=populate
v u! |7 {" ], f. n' Y( f; [) p e$ x
function scrollmarquee(){. \* L4 X6 R; J
if (iedom){
9 c' \2 p, i8 V8 P3 v7 |if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
. n0 N* _# i$ a; u# ^cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed/ h- D, \" A( l. X
else
r, @9 \8 Q+ }- U8 }4 Xcross_marquee.style.left=marqueewidth+8
# s) ]) o4 o8 d) P3 w7 G
/ c6 G& F$ q, t}
( e6 X, F$ P5 g- ^else if (document.layers){
" w2 m% x: F* D6 C# B9 {5 `if (ns_marquee.left>(actualwidth*(-1)+8))
! w. L2 Y) f/ ?& }& ]% Zns_marquee.left-=copyspeed
8 Y7 Z' @; h p& l2 Relse3 g" u2 I4 F2 Q& x
ns_marquee.left=marqueewidth+8
6 t# b. u/ ~7 S9 m" D' m. m( n}( G& w2 Y9 J L9 p2 R3 H) R
}
+ X+ S6 C' b' m0 F
/ D$ ^4 ^& R6 I* K" \% bif (iedom||document.layers){" L' p# x% v' \6 G3 H
with (document){/ h% y; E& |( [7 O
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')6 ]% X3 Y2 N4 @& d1 E
if (iedom){
* ?" M9 @- w7 r& k* Z4 \+ [7 twrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">') x: |" `* m7 V" p7 j- t
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
+ o5 A! G1 H s" Y3 v9 zwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
" g' l8 D# d+ V6 [! E, |write('</div>'). a7 }% G/ }! A
}
# A) q1 `. f/ u% g* f M t' o/ gelse if (document.layers){
% U( V4 _8 j% k4 K! u! ]4 [write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'); b, n7 Q* F, s% C' ~
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')$ r# w1 F% B; e1 q: s3 e
write('</ilayer>')7 i$ d3 Y1 E$ o
}% P) S+ j* a; j$ Q, {
document.write('</td></table>')
( g! o/ ^2 a5 U( Q}+ W. f1 z' Q {. a5 F' N0 r
}
4 y5 y% v% {( U5 R</script> |
|