获得本站免费赞助空间请点这里
返回列表 发帖

网页之跑马灯文字特效

//修改宽度
( D- I' |5 E+ c0 D3 bvar marqueewidth=300
1 X7 {- }$ w8 W$ E- {7 |- _" J//高度2 c; z: w7 Z4 N5 A
var marqueeheight=25' V, j7 z7 b- C: [  L
//速度(1-10)8 O: m2 M, s) g5 H6 q; k+ T
var marqueespeed=3: N" m4 L. x- T
//背景颜色
! g6 b  Z3 o, O/ Q& \# ovar marqueebgcolor="#FFFFFF"
" a, P8 H8 J' h  Y% B/ E/ o//是否能暂停 (0=no. 1=yes)?
7 L6 d. k8 p5 g" |9 Fvar pauseit=1
) O+ o& [9 l4 y. F4 N/ B4 K: o/ w6 L+ h/ H3 ~0 t7 k/ ~; t& @
//修改显示内容
+ A: j. w8 B1 {9 evar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
# ?$ ^4 Y0 {# k  {) p, ^
' z' K  J$ p1 B6 {, P; d9 r$ G' r0 v; K# p) M
////下面不需改变////////////
6 w, I4 Z1 z% ~% d2 z
9 D" U0 E6 R/ T* Tvar copyspeed=marqueespeed( r7 A$ D- b: q: `1 z
var pausespeed=(pauseit==0)? copyspeed: 0
6 Q/ t0 G# u- |# Gvar iedom=document.all||document.getElementById/ Q: ~+ O5 U0 Z
if (iedom)
/ {# X) e3 l$ l  z2 d1 @: f' D4 udocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
5 H# `) ~" K. {var actualwidth=''
; D" M! R$ _+ x$ q" L7 S( C7 o7 xvar cross_marquee, ns_marquee3 t+ C: ?/ c% H! f2 O4 J

0 ^# _. q0 M$ p" e8 ?$ F3 V& nfunction populate(){
8 @  N; j7 `6 r- g5 D! E* [+ s) fif (iedom){
8 F: l2 ?4 f5 h, b  b5 S& U. hcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee+ s+ f' ^1 x. S1 V
cross_marquee.style.left=marqueewidth+8
0 L( y) _# K8 w" Y1 e3 F. c! [cross_marquee.innerHTML=marqueecontent
! U  `7 O2 U$ S) d# v& p$ Xactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
5 S2 f. H; G, r}% F0 s- N# N3 \- H2 J/ ^2 C
else if (document.layers){
7 T: I+ E9 W/ T! d1 B1 vns_marquee=document.ns_marquee.document.ns_marquee20 L  L+ P8 X7 G
ns_marquee.left=marqueewidth+8
. z- b2 h; _8 u  y9 R' _ns_marquee.document.write(marqueecontent)0 B( i# r. s& w' d4 z5 G) T
ns_marquee.document.close()8 C1 a  F1 R" Q- {  _4 v
actualwidth=ns_marquee.document.width
3 I; l$ p" k7 |3 R% ?, v& x}
8 H; u! n: u4 U( p1 Ulefttime=setInterval("scrollmarquee()",20)! t/ e- N; Y5 y$ O# k
}8 T. `; e! o: ^
window.onload=populate4 p  b' R- t* T# t6 e" V. ]: k( \

, h; j% q6 f5 c; wfunction scrollmarquee(){
8 d' k; |% G- E2 Z  O( `if (iedom){
" S3 k# \! A6 @; R! Gif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
8 e) S8 H% J! v9 S/ ~% O2 kcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
0 C5 R$ e+ }9 T4 n8 ielse  f; t! _0 B; D/ n5 a
cross_marquee.style.left=marqueewidth+8; k) ^# ?2 K& o8 }# ~, N) E& l* j( B9 a
2 h( I% J) V% V
}
! s' N2 u7 x' P* c0 Eelse if (document.layers){* f! b. w: x- J8 }& t1 Z( R9 D
if (ns_marquee.left>(actualwidth*(-1)+8)): @! l5 j: @( ]* }. v
ns_marquee.left-=copyspeed
1 a. T! x$ t9 jelse
- ~6 @" x. ~8 Cns_marquee.left=marqueewidth+8  ?' ~- O# j- R! v
}' P+ Q" v$ c# C
}; J* v5 c, U8 `% ]7 x$ j: N
  T5 @0 H2 e! p/ y0 N1 e2 n$ T
if (iedom||document.layers){) X* Q! G, T. {
with (document){
  s1 R# A0 }; c# Tdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')/ V* M& i( D8 E; d3 f8 ^# B2 ]
if (iedom){
: D3 c( ]# Y; ^4 {; p' D1 jwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
; `. W3 O0 O& ~( Q0 twrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')7 H# O: c' T$ ~* D6 ~
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')3 S& U6 s( N2 B6 D, |. V! o+ F! j7 ^
write('</div>')
; Y$ B6 c( j  E1 G+ y# @+ P8 Z; l$ y2 V}* ?# u4 e( N$ v0 U
else if (document.layers){0 T0 ?* W- Q1 s$ r8 m  o$ J
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'): b) K2 p2 X) K  Q' l- {
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
' S5 F' p+ N% nwrite('</ilayer>')7 t$ o# Q# M( {: _; t* m' m
}" ]5 z6 Q. Z  m7 j0 q0 b
document.write('</td></table>')
( \$ T* k' O  M9 A}9 K- D( C8 f. _) Q
}
- H! Q! f8 }) a1 Q( C</script>

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