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

|
网页之跑马灯文字特效
//修改宽度
& j& @' D9 o( J5 s1 `var marqueewidth=300+ X# _. C3 Y# ~% u( P
//高度! |; {* q; }2 f" G, ]
var marqueeheight=25
: G. V) h& m5 k7 ^//速度(1-10)! k! e, H% g2 Z
var marqueespeed=3
" Z* w C, p& c0 @7 a3 g//背景颜色
/ B9 W. ?7 o( y. a5 Q+ z5 Xvar marqueebgcolor="#FFFFFF"
/ Y0 y' m" r% |7 b! y//是否能暂停 (0=no. 1=yes)?
P; g( \$ d/ N7 d9 E$ Rvar pauseit=1
: t* X) W" j. C1 O2 s2 Z0 m* x5 A3 _; I( S- Z
//修改显示内容
' B$ [% t$ T, Q# p: K" E; bvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'3 |7 J& |: x) s4 |2 s$ \9 u
' r. r: v& @- r. ]8 {! u
2 U9 m( G3 d' h////下面不需改变////////////$ H. I: V9 ^5 g- s' E4 S- p
1 u) Q, t" R8 _. Z1 Hvar copyspeed=marqueespeed& c0 N3 n1 j M6 E& l
var pausespeed=(pauseit==0)? copyspeed: 0
: X7 V# t: c" |" y8 }) svar iedom=document.all||document.getElementById
+ A9 N) e. A" h1 F/ X3 `* eif (iedom)& l S$ H" x# H0 o R
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
/ o0 K5 N5 c+ Y- Dvar actualwidth=''
. J: I6 ^- ` o5 i" K- ~& rvar cross_marquee, ns_marquee
I9 [( k8 H- @2 R; r# i/ p3 s" @* s' _5 i
function populate(){. I+ w0 w0 r# r' A4 p
if (iedom){
( [" D$ u9 S7 c) d, \, e2 C5 p+ Z1 |cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
& k4 F" C5 O& L+ fcross_marquee.style.left=marqueewidth+8
& b% t( i# U- |- {cross_marquee.innerHTML=marqueecontent
" q. }6 _+ t; factualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
+ b7 J8 u, p/ f( Q. W0 ?}* b3 { K7 e# @* }. F
else if (document.layers){
" f6 y8 b0 S3 e5 h/ E0 z9 J, pns_marquee=document.ns_marquee.document.ns_marquee2
8 I# P, x* x( Yns_marquee.left=marqueewidth+8 \. ~/ f, @: d" {: q" N8 R; i
ns_marquee.document.write(marqueecontent)
. h+ L8 M' m! r' k- e7 X6 o1 ?$ wns_marquee.document.close()% q3 p5 F1 {4 q+ v
actualwidth=ns_marquee.document.width
4 E$ M+ R/ H6 l$ L1 `( e% _2 j3 X; P}
5 h' \+ H3 _, m. S xlefttime=setInterval("scrollmarquee()",20)
& E# t- `2 g6 r2 p, W4 U}! ~. ^7 F6 O6 C9 S. ?
window.onload=populate
+ I2 \& }" \; s: N. @1 s# P% c' P9 ^# s4 L' q: {
function scrollmarquee(){9 N5 {. ^: `; B# S! J% ?2 @" H
if (iedom){" x0 J! @5 Y/ ]) q' V% B
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
, y% g# c5 j' a) D: gcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed, h, f4 Q5 z5 j @6 Q' X
else
; q& z8 q; y* Q* hcross_marquee.style.left=marqueewidth+8
. E& t- C& z6 M( F. B/ L/ k6 ^7 C4 h B% h4 t
}
3 y+ y, b" u' d# Q @# P2 ^0 C. }3 Helse if (document.layers){
: X" x! @' F5 J5 R0 E. e! R# Gif (ns_marquee.left>(actualwidth*(-1)+8))+ o+ |/ F: F& U4 v3 D
ns_marquee.left-=copyspeed
( V$ W v2 {8 x, {& K# d6 Felse% v0 W' U3 P3 k0 |% G R7 T; F' g
ns_marquee.left=marqueewidth+8) b4 J. a8 w9 D* d0 q
}
* {2 b8 d* {6 U2 e% |2 N4 ~% G! ^}
8 n3 U, s& f( ]# x. F$ H
/ F6 a& s/ }: p4 @- z2 Wif (iedom||document.layers){
: D- h H i4 @; P4 I4 x# dwith (document){
: B8 b# S2 D$ U6 n; a: S- x8 z: s$ bdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>'); t7 M6 `$ g/ e: d9 ?
if (iedom){
- q* \/ k$ y7 |/ g9 g8 B; ]write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
9 x" ^3 v, ]- R+ }- uwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
! L" l9 x5 J: H) pwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')$ t2 o# b, d. ^2 t$ b! T( y
write('</div>')$ k7 ^; p4 p5 M1 x9 H2 w5 k
}, G! ~/ y- W# G. |. i" g
else if (document.layers){8 |/ f" _: N' @$ i! L
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')- t: u0 R2 t2 j% y' J+ v" U
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')9 y: K* @, `1 `2 l4 P
write('</ilayer>')
3 J, U9 U! O! m9 F}
* A1 k/ b$ ^, N8 d+ G6 ]document.write('</td></table>')( S" w( L o$ T, t; x$ s
}# \- R6 g3 y2 X1 _, C7 a8 R# g
}
# N6 B# v8 B6 [% C</script> |
|