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

|
网页之跑马灯文字特效
//修改宽度
! `$ M( b9 [$ `: C& Hvar marqueewidth=300
% X: r; u3 \! ^6 s, |//高度
# R" T( L, z4 {2 _: E- ~& h+ @var marqueeheight=25
- o' f/ Z* S1 p5 q& O# T//速度(1-10)2 y) ~ S2 r7 e4 T
var marqueespeed=3
. O1 }$ j; G6 X( [* T0 H9 j" f//背景颜色
) x+ @4 j4 ?) lvar marqueebgcolor="#FFFFFF"
5 ^+ [& T8 [& a5 U# ?7 h//是否能暂停 (0=no. 1=yes)?
: }1 n4 M; L5 Rvar pauseit=16 I: A) d5 w7 W8 ?
6 j) Y' y/ g' u0 ^5 R) y- H0 E8 H: s//修改显示内容" J& f9 p- K- y9 x* K* T7 C
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'1 ]+ |9 Z; r' q6 i& ?1 Y
- d# L" y$ C( k, \) I% {
, V' G7 M9 ^3 A% A, ~& a
////下面不需改变////////////: C- ]! `2 L p
" Q2 U1 m: W5 N% r! i+ r, y
var copyspeed=marqueespeed- |1 |2 f+ v% r' y
var pausespeed=(pauseit==0)? copyspeed: 02 B2 r8 O _/ p4 Z. d: G) D* a/ f8 z
var iedom=document.all||document.getElementById/ G0 u+ ~1 [! g& I2 r6 @6 F( e# K
if (iedom)
5 a4 S4 w: ~6 s. c* X. gdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
/ e2 o; S2 W, Y5 k U! x$ B m+ l$ Rvar actualwidth=''8 k3 A) w- @4 S: |7 A$ i
var cross_marquee, ns_marquee5 A& {- i( r6 i0 f+ X
# ^1 D5 t) N3 h0 xfunction populate(){. e" K6 o* \/ F
if (iedom){9 A# I# \5 q# R2 F1 N
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee# c- L1 ]# G5 q8 ^) ^& Y7 r
cross_marquee.style.left=marqueewidth+8' h X- {. h* m) T. z- |& ?
cross_marquee.innerHTML=marqueecontent+ p+ I5 C" h$ }
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
2 w# _6 J- G; b2 M) D, G4 W: N}
c% v( M7 I( ~$ H' f D, velse if (document.layers){3 y- g9 S, J- P( h( q' T: t. ?5 q# f
ns_marquee=document.ns_marquee.document.ns_marquee2
" B( z, _9 X6 {' Zns_marquee.left=marqueewidth+8. C5 x3 g5 a1 T5 G
ns_marquee.document.write(marqueecontent)) u+ Y8 q2 a. g& o% d) ? s
ns_marquee.document.close()# O3 L+ v6 R# n3 W3 G
actualwidth=ns_marquee.document.width" i- M; B2 i+ P* I" P1 `
}
* e0 N1 ]% ?6 `9 clefttime=setInterval("scrollmarquee()",20)
% {4 C$ p9 w! j( c/ v1 K* I}
! X7 f, Y" @% f3 }; z! A8 u) r3 nwindow.onload=populate5 t2 M! k5 S y# |- q3 m5 L5 ]
& n* S3 k3 u/ X( ~! {7 Y7 vfunction scrollmarquee(){' c0 ^& Z$ |4 R0 v5 t
if (iedom){
6 y! h" }2 Y+ G& C. Jif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))* z& d! r5 U+ i# Q- p+ ]
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
5 q! r) q& R1 N: Y# yelse" G" p* V6 G4 h* p, H/ S
cross_marquee.style.left=marqueewidth+8$ g, G7 z0 ^0 o3 }1 H
' L. f n8 v8 ?; l0 Y2 s}6 l5 S+ ` R- P" [/ e
else if (document.layers){/ h# D$ B% L* b* ]
if (ns_marquee.left>(actualwidth*(-1)+8))
& P" {* d8 j) H! `' A5 K4 }# v# Kns_marquee.left-=copyspeed s* U& z) f; m
else6 t; l8 Y' P# z; P( ?& w |/ W
ns_marquee.left=marqueewidth+8
2 P( k' \: K! M; ?% g; j* T( ^6 G}, ]- c! r2 ^3 q8 E D8 S' C
}$ C8 S+ w7 {/ X, }
; D$ v X) ]* c/ X/ O
if (iedom||document.layers){
/ o1 j$ O9 z: b. n8 fwith (document){- \: ]/ `" V0 \. F5 K
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')$ M( q1 y- P- c6 v3 C
if (iedom){
) h( B1 c# a9 P5 x4 ~write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')# S* r) A0 z/ Y2 s# b
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')/ f% O4 j" L* P6 N. A4 A: `3 q
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
# z* \+ L2 @+ u0 gwrite('</div>')
& M" c" ~4 I1 b. T, X}
5 p8 l R4 v# R" c; f/ r2 J# Belse if (document.layers){( N) }6 E% Z: \4 g+ M* e
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
5 G& E4 f8 e* g7 _8 ?' Bwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')2 K( Q. T$ r3 y* k& G5 ?
write('</ilayer>')
. K5 {; z2 U6 H2 |3 Z+ r; \}
( ^* `9 W) ~2 c s# A- N# {8 q* mdocument.write('</td></table>')) v, Z% Y) m4 a: k: ?
}1 C0 }1 S2 p# I
}% d" G! M! D8 H: s
</script> |
|