返回列表 发帖

网页之跑马灯文字特效

//修改宽度
! b% P1 E/ @4 y4 U' \& S$ O5 ^var marqueewidth=3001 Q7 @& Q  [/ I- m' u! \
//高度
9 ]/ T2 ]: O( U6 b# b/ N5 ?5 C. y& X% lvar marqueeheight=25& _2 Q% n) H' ?8 `/ W& c- Z- i% P
//速度(1-10)
% }* q2 A! @( I% Z! P3 `& b' ?var marqueespeed=3& K0 M. l6 d" G) |% a. W: \
//背景颜色' c7 I1 n: i: E+ Z8 |6 W
var marqueebgcolor="#FFFFFF"
$ b8 T; a- k. F( P# c//是否能暂停 (0=no. 1=yes)?& b4 p$ H: ?3 M% R2 R: f
var pauseit=1
$ {( p7 O7 u& @. F/ a) ~' z2 {1 N' y& v9 U% P
//修改显示内容, j& F6 f; o) ]: N: V8 u% r0 n
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'# u5 w+ u) H* P

% E# O( o' \2 g3 V2 W! [5 P7 }" H2 ]1 H; [! K" v) Y- v
////下面不需改变////////////
& F3 v5 @5 {; q
; n3 v9 U6 v) `4 B* ^8 }# }& l/ l4 yvar copyspeed=marqueespeed( Q. s. z6 A, J/ j" G
var pausespeed=(pauseit==0)? copyspeed: 08 l1 s" b% e3 U" N
var iedom=document.all||document.getElementById1 a1 [7 M; Q9 Y' A8 {+ s& @
if (iedom)( f, z. d8 U0 C! M: m8 \
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')& m! t, c! B3 L- V0 J+ M, P1 V
var actualwidth=''3 x; K* ?& {; \# J" u- k& n
var cross_marquee, ns_marquee  Q4 o- y. i2 s9 n& {

( |! a3 W. k4 @/ Ffunction populate(){
# a2 [& m4 k9 D. Q' Q, K6 O4 K6 Kif (iedom){1 g' `* t. H# A0 R9 W
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
% O) G  y9 U8 R# f" qcross_marquee.style.left=marqueewidth+8$ q: [+ c; |( ?  [
cross_marquee.innerHTML=marqueecontent; I* K  D- \& f+ p! S, v+ L7 j
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth8 b/ g/ S# p4 }! k
}0 r' ]( p1 }& f# [
else if (document.layers){6 ^# v: x& p. _; F* o: S( I0 p
ns_marquee=document.ns_marquee.document.ns_marquee2
+ r, G2 W9 I8 C# q+ n2 Lns_marquee.left=marqueewidth+8) U8 n5 {. }3 F
ns_marquee.document.write(marqueecontent)
* w- |" ?3 t7 P' B8 j/ P' Jns_marquee.document.close(). D; [, b8 ~2 f" c& |8 M$ l, F5 e
actualwidth=ns_marquee.document.width
) I% ^8 _2 [" U* I4 E  n+ ~}4 A  t1 f* _6 f
lefttime=setInterval("scrollmarquee()",20). q" s& o1 h" }% T% t
}
9 Z6 t( I/ k( G, w3 X4 i' c9 Xwindow.onload=populate
1 x0 r1 A2 y1 g6 [/ N3 f" l0 m) c" t1 @; P: ~
function scrollmarquee(){' q: k7 Z: N5 b2 ^( m
if (iedom){
8 j8 h8 d4 Z4 y+ _( |0 jif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))% Y# R% \( y4 o0 S+ r1 r
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
* \5 ?0 I* }$ p  ^else
. P, f, ?2 U" ~) W# Vcross_marquee.style.left=marqueewidth+8" v  U3 @2 _8 n, Q
: k3 y6 I& ]+ A) U. ~
}2 A6 ^9 s; B) _) ]
else if (document.layers){
5 e% J' _$ V, R4 `: W7 vif (ns_marquee.left>(actualwidth*(-1)+8))
: e, K+ n$ E" p/ ]ns_marquee.left-=copyspeed. a" B- u! f  U) t7 G
else! ^$ @7 B) p. T. K7 O
ns_marquee.left=marqueewidth+8
4 I. w# V4 G- C; m) h7 f}/ M# v' @5 h; L5 O* u# B1 s* i
}
1 v/ g' t, v( J: d% E) L, @# k: ^  q1 r0 D0 |, r
if (iedom||document.layers){# f4 Y; H' y6 F1 ^% r
with (document){9 z2 q! a) q% T) Q
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
2 D+ E0 W8 [& C% ^0 q- Q9 [, nif (iedom){
4 [$ m  B7 N! Uwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
* S) T' Y- g5 U# b. b: f+ Lwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
  a' R& r1 E5 v* {write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'), ~+ J: T. ^; E! ?3 k1 h+ ], ~
write('</div>')
5 \: V4 O6 T3 R2 f6 Y& F/ M}0 G* F% k5 I; l' }' H
else if (document.layers){
/ b/ \5 u& s! _* P* t: O- M$ Ywrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')) p6 N  h* t9 B6 I4 |1 n
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
9 O6 `0 Z$ t! c0 z1 I3 m% Rwrite('</ilayer>')/ V* T7 j! Z8 l- s5 V
}: V! A' |; i8 ?8 g8 v2 b7 `: F. ?! Z
document.write('</td></table>')
; T. I6 v" e) R}
1 N0 Z! }& A- G/ o5 p( {1 }7 G}8 \) s  r$ {4 [
</script>

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