返回列表 发帖

网页之跑马灯文字特效

//修改宽度
& o; `0 Z5 Z' z; G9 \) _  vvar marqueewidth=300+ y3 ~1 b6 f4 X9 |. `$ V
//高度
# N& S" K! I: L% U( U& c! {$ }var marqueeheight=255 a. F5 h) y4 i) }+ f
//速度(1-10)
9 q( C# P5 B. b2 P- r; a" dvar marqueespeed=3
$ d0 U4 w9 c, A9 `8 G//背景颜色
/ Y+ j& x0 ]) [0 m+ M$ u- {2 Cvar marqueebgcolor="#FFFFFF"* u8 M7 H2 u# X$ z5 S% w4 s- e  P
//是否能暂停 (0=no. 1=yes)?, W: S3 d* u1 y: X% ]
var pauseit=1* v4 c+ T+ e5 G) s
) e9 Q2 z; k5 a' _. G8 B2 X
//修改显示内容
- E1 }$ P9 @' g# ^3 V5 }$ X4 `var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
5 \  E, s2 X7 W0 ]9 d2 @% @+ V' K! O
( c: \3 w: u% l
////下面不需改变////////////. S4 ~* E" `: m
, G; N" ]: T3 N1 M* i
var copyspeed=marqueespeed
) g- D7 [4 P1 w+ C& Zvar pausespeed=(pauseit==0)? copyspeed: 0, B; M  a- m8 s# Z% X, J1 F+ I& M
var iedom=document.all||document.getElementById
. c, d" m& G4 B$ a( C& l7 lif (iedom): w( M7 B/ }6 S/ r- V
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
" |9 E8 m; a% Z1 O8 \var actualwidth=''
1 s! X: k% W: `3 |1 o$ p, Ivar cross_marquee, ns_marquee
6 p, Y  k& b6 K' y
6 P- z. |% w) v' ifunction populate(){
) O6 @6 i: c1 s( }- t9 d3 _if (iedom){
8 F# W5 V3 x; c" v/ P5 \% C& R% u" ]! e7 {cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
0 |1 g, \- H5 ccross_marquee.style.left=marqueewidth+82 [% D- p  D9 n0 _' w4 k4 A
cross_marquee.innerHTML=marqueecontent
8 b. c4 Y% ?, p. [6 }$ cactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
/ b4 o" {5 X3 {3 K/ e  Y}, `4 s$ {( ]1 `
else if (document.layers){
& q' o" Y8 Q/ Pns_marquee=document.ns_marquee.document.ns_marquee2. F$ q" Q$ C( x1 o* ~# I) y
ns_marquee.left=marqueewidth+8! j3 T' k- Z4 s9 d8 ]) W4 a! @
ns_marquee.document.write(marqueecontent), x  F  W9 z& I' Z7 x/ R1 O" U
ns_marquee.document.close(), y$ M- ]& D$ |9 p7 d& T
actualwidth=ns_marquee.document.width
; r6 @+ ?: a1 C% ~}
* b9 j8 @! b. b% J. J1 Ylefttime=setInterval("scrollmarquee()",20)
; |3 h; s6 B+ D: o9 _0 k}( p7 u0 B( s3 F6 x$ X# J% ^* h
window.onload=populate8 {; ~' T' _1 x  k" I# R4 y+ k- W
; _& [% q" }8 y. D* s' N+ z" p
function scrollmarquee(){
) b, i  d# P' m/ Fif (iedom){
# K) t* r7 m: K  a) dif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))& |) ~* {- f8 v/ w8 l4 l
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed- F% h" M* m" c! `0 i4 ]+ |9 |
else
+ h6 i/ t: z: R5 S1 F7 Mcross_marquee.style.left=marqueewidth+8  W0 p- ^, E9 N
! ^' L( i& I) B6 _( x
}% s; {  V# q2 t8 K$ ]2 s& A) ]
else if (document.layers){, |* Y/ w& o  F, |- e
if (ns_marquee.left>(actualwidth*(-1)+8))
* y- ^: R3 L1 ^( R9 j, X) \( Ins_marquee.left-=copyspeed" L: A, \  N7 D  t: a3 }
else
" R$ v# `9 j9 k! Ins_marquee.left=marqueewidth+8! P% b" n4 v; L: O
}# I! \) L6 E, w# n9 i
}
) ?9 A+ j, i, u6 `8 z; ?
, r- P# P: z; }if (iedom||document.layers){7 \  J9 @9 K7 v/ u  h  j" ~4 ?
with (document){
/ L* x! E  z$ n6 R0 T) ]document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')0 r3 ^4 S8 x# f% Y
if (iedom){
# s/ U, ^0 I- v9 m5 J/ Z. f/ owrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')' Q: ]- {5 ^9 l3 r) V
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
& `3 _6 E8 `( G% a" [4 {# V8 p% r) Nwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')4 f* s* ?7 d/ `2 {7 Z+ f1 \8 U4 \
write('</div>')
+ g5 K6 [" h0 y- [6 c- L}, U$ t8 X! j4 d/ o. E7 o& l
else if (document.layers){9 j9 L5 f( V7 B1 h% I6 r8 p
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')( _# d$ i; \- ?) v
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')  h: x; E2 W: W8 F
write('</ilayer>')) t9 Z2 C- E3 ^5 K4 T7 [/ o& x& U( {
}2 D* Q: t" \/ P$ K/ T
document.write('</td></table>')
9 q0 H, H3 b" q% D5 L3 A( I- V+ ~}
, q! ~" e8 I; M' i}
6 c) k  M  \3 |3 }</script>

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