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

|
网页之跑马灯文字特效
//修改宽度" {5 U/ t n% s& _, p' V6 |
var marqueewidth=300
1 x0 M3 _5 S; ?6 E" Y, l! `//高度 X% {) a' w% d
var marqueeheight=25 Q" {0 k9 K# N4 p
//速度(1-10)
) k( g( I3 Q( l; ]4 ~3 W Nvar marqueespeed=3
! g) X8 U" u" G, t. E ]//背景颜色
( O1 j8 e( J' j3 J- uvar marqueebgcolor="#FFFFFF"4 c; T; e+ n- s4 g, m' w* ~9 M
//是否能暂停 (0=no. 1=yes)?! G% X: K( t& i: v
var pauseit=1
1 C7 S. b) y, x- H1 g& z- |' H' p* F) x2 {6 \/ j& M$ f# w8 h
//修改显示内容
P2 E0 ?7 e4 a7 Y8 vvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
) S! b+ x) g/ O. I6 S* q! B, a) o; n3 f: \" v
, c/ J: O* T" [2 f. ~+ k, I" W
////下面不需改变////////////
9 k1 Y. h/ \5 h* {8 `3 S6 ~- W0 W: e+ M1 }; y- l
var copyspeed=marqueespeed' ?! X( v, }; ?9 b
var pausespeed=(pauseit==0)? copyspeed: 09 h2 b/ B& e2 K+ }
var iedom=document.all||document.getElementById3 m. m# m% A5 }! o9 f
if (iedom)3 [8 o" A- G3 y; b; z H# f
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'). X; v, a4 q) s+ d& @& \4 G$ B. \
var actualwidth=''
' O# R, B8 V( k! r+ v2 Avar cross_marquee, ns_marquee
2 p- F0 e" ]/ X; r; j7 n! J
) Y, K1 X) T: V8 {; R d# Zfunction populate(){
2 |0 [+ b8 |) [$ u5 I+ ?if (iedom){
8 A' B( ?4 z/ r7 l: Pcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
1 H+ a! J( a7 j* F4 m1 v! wcross_marquee.style.left=marqueewidth+8
; C$ S; a: X! _+ M+ @) |- [+ Ncross_marquee.innerHTML=marqueecontent
. |, O. Q# C$ t+ H, @! F) ?actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
8 j7 `5 R8 M3 |" C$ N: I& G0 I}
! N6 n8 j$ N! B8 H7 B. K0 yelse if (document.layers){( x' i& g$ ~" c: N0 V- J
ns_marquee=document.ns_marquee.document.ns_marquee2: h9 L' ^( I/ _1 O4 q. l. `! Z) N
ns_marquee.left=marqueewidth+8
3 ]6 L- ~2 o, d2 jns_marquee.document.write(marqueecontent)
6 Y5 x0 K1 @. b! }/ Ans_marquee.document.close()! n; H, I' E& r! ^
actualwidth=ns_marquee.document.width3 C2 `2 [1 @5 w j2 n( L4 T# J
}
* I9 H1 J! i' P! W8 U0 O7 n4 Klefttime=setInterval("scrollmarquee()",20)8 e! W A: ^$ J6 ?
}
& K# X7 y8 b$ Y5 ^+ j6 }3 _& B0 bwindow.onload=populate7 b( k7 K) D; [. E' E
6 x, R5 X- P% O0 [$ ~7 U; j) B+ n
function scrollmarquee(){' d; b! y3 _9 i0 _& \# ^0 X
if (iedom){; U7 c, {) n2 ^$ a% L% q2 E
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))4 M0 a: g2 F$ E% O* G" e# H
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed! O( `) Q. Z0 p: F6 M6 [
else
3 B" s4 }7 ?( ^cross_marquee.style.left=marqueewidth+8
5 z# @' b/ z4 |/ h$ f9 D& Z( A$ T4 v0 ^8 D5 Q0 K n7 f
}
$ I c! x& S' s- S7 W+ Velse if (document.layers){
) B. [8 J( i. {if (ns_marquee.left>(actualwidth*(-1)+8))
0 t* ]. @& p. F3 J- |ns_marquee.left-=copyspeed
- v# J6 K. S, Pelse! ]# @; q/ n7 p! t" T
ns_marquee.left=marqueewidth+8, K) g# i, K# F& _# u( c! _
}
5 H9 R! S" ^4 K+ D}0 u4 L, R0 c) B# I
6 O- t9 a" d7 |, g8 r
if (iedom||document.layers){
/ b# T: e# f' C: t$ S+ ^3 f: ?9 [+ G1 Nwith (document){
) d* A: L! P; [0 Pdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')/ m1 D" a) i3 t6 Q5 z
if (iedom){
+ H/ Z! _ p# R) g* qwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')9 a, n4 j/ Y. V9 l
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
+ n: b6 {" E) l8 p$ w, Dwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')( R6 E9 ^$ L) c0 V# r
write('</div>')
( H- I# c/ p1 H5 r}
# R, \7 F) y7 F% z1 Pelse if (document.layers){' D, S* x! K' Z, }6 z
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
" ]! B: b* b. g) h' Jwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')" |! ^+ W9 T3 O( X% J8 B2 j
write('</ilayer>')
% X* N% T7 R% S+ X9 O7 O9 x( P}& f& U: B$ V4 m+ m; s1 V, Z
document.write('</td></table>')
) @0 e! Z6 M3 ^}# H+ e( E" E: x1 Y! O
}
: D: N6 T6 m' o% I6 E</script> |
|