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

|
网页之跑马灯文字特效
//修改宽度% t4 ]' ]3 G5 b y/ }( ?
var marqueewidth=3007 w. n; I; M/ f& v9 d7 M6 M
//高度
+ A( c$ p: F1 }4 U9 ^6 Jvar marqueeheight=25
6 O1 Z, z4 m9 h) q//速度(1-10)
/ p4 V0 u0 b' a3 yvar marqueespeed=3/ a0 d7 D% R7 v5 |2 c& `, X# {
//背景颜色6 _2 t3 V0 f3 v @
var marqueebgcolor="#FFFFFF"
; r+ P/ x- _* [5 W% t# z, R//是否能暂停 (0=no. 1=yes)?
* U. t, @: ]7 ?var pauseit=1% p* e3 z; p' M3 G
9 H7 E$ M7 y6 t8 ~1 b
//修改显示内容; l4 m% b# _- j) D1 O
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
6 F: B6 p: V. y$ g$ }
2 | W! L5 A' T) G
. s" h6 Z) g1 V$ }3 }- b////下面不需改变////////////
4 }( w1 u" j( \2 Y: }4 D# ?+ @+ C
var copyspeed=marqueespeed: G3 b$ N9 r8 \ t$ X* H6 f' X0 q; U
var pausespeed=(pauseit==0)? copyspeed: 0- Y; Y/ L) k# B: X. B6 ?- l4 Q
var iedom=document.all||document.getElementById9 Y& |+ c! j6 K5 X' j9 l
if (iedom)
5 c2 }( b( _* W1 d+ pdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')( U2 I( |" \7 w4 k
var actualwidth=''1 q. \: g* r$ @2 c0 b6 L
var cross_marquee, ns_marquee- o% u& S6 v) S( j" o [+ M
: ~5 N% K1 I& z( ^, c6 s
function populate(){; j, U g |/ E4 ]2 `
if (iedom){
# f: A" S) J: u' Mcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
( P( O/ @1 J; ^cross_marquee.style.left=marqueewidth+89 @! H- z* o7 q$ q, D) x3 |
cross_marquee.innerHTML=marqueecontent
2 _/ w3 Q& v' S J/ ~( X2 V/ z+ vactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
: Y) P' e, X6 {9 e J}
$ \3 z0 @+ [( U5 ?else if (document.layers){* y7 l% X+ o ?# Z4 z: u5 C- F
ns_marquee=document.ns_marquee.document.ns_marquee2
7 t' U; W' n: J. `" Z+ ^0 nns_marquee.left=marqueewidth+8
8 C7 @$ f( n$ N, P" j2 ]! g# N( R7 Dns_marquee.document.write(marqueecontent)
7 b6 w( q5 i+ u, U; c! y- Gns_marquee.document.close()
. M0 L1 G$ y: B" uactualwidth=ns_marquee.document.width
! |" O$ F& p1 v7 I}
0 [1 G9 p' y) {1 Y4 c5 H) J% ~lefttime=setInterval("scrollmarquee()",20)2 w: j. C: w- W8 f$ n+ t0 `
}
3 R( A, T6 z- G& Ewindow.onload=populate( l4 y0 J/ W7 j. ], g" X0 o; R4 |$ j
3 P3 R9 M8 J$ T* |) W( c9 pfunction scrollmarquee(){
: v0 @% B6 |& |6 }2 qif (iedom){+ J2 S( @; w2 h5 {4 ]! l
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))! y b$ @ U9 P6 a, Y6 _5 g9 T
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed; W, V3 P1 j0 F+ \
else2 I) B# T. X/ f1 p
cross_marquee.style.left=marqueewidth+85 P- R+ O+ e- E9 B. c% l
1 m- Y0 X+ Z( S}% ]' ?* B8 C5 |5 G V9 |
else if (document.layers){
% m v0 r" d U0 x& q4 I! Yif (ns_marquee.left>(actualwidth*(-1)+8)); h d1 I4 t( W" H
ns_marquee.left-=copyspeed) W3 a2 F" @- b3 b
else
( }- Y( s! h3 E& [% hns_marquee.left=marqueewidth+8/ B9 V! [4 [) l
}8 H, x4 |" [3 {
}' x4 a7 c3 Y; w2 R: T. |
( ?! w+ P* @6 {. ]% Fif (iedom||document.layers){; j% @; f& H1 e: ~2 O" h
with (document){
# [) [% K0 W6 s) Cdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
( A; X( I0 g1 C3 W, N) E- i0 Xif (iedom){
+ f) u, V6 |* y5 a8 t* f/ u, cwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')% S/ w/ V. a# B: Q$ t) J
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
8 G2 C9 V9 V1 U& {3 n- p1 ywrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
$ s# ] ~5 t; R6 J0 o, @3 ?3 Bwrite('</div>')# i! Q: J! ]2 X6 w" S
}
) F: Q6 g" x s6 Felse if (document.layers){
Y- z1 y3 ?: i9 R# _+ |write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
s% K! I x- Nwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')+ J: n2 H: t7 ^0 G+ D: | |
write('</ilayer>') s F: o# L9 V" L# [& b- Y- d% K' j
}6 j+ N3 ]$ D/ G- V
document.write('</td></table>')1 V0 `# Y4 V2 C8 H/ S+ d# e$ U6 @
}
. o; f4 T; m* P4 |( I. T# h}" ~* g+ ?, N! \, {6 d) A# h( D/ [
</script> |
|