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

|
网页之跑马灯文字特效
//修改宽度+ Y: @: z- d! s/ i
var marqueewidth=300
3 V8 S; z7 X. N//高度4 q; Z! g2 \% z! K
var marqueeheight=25$ W. }- Q( K* R* f9 b
//速度(1-10); v( c$ w: c& |" E$ }
var marqueespeed=3# {, R; H5 P# U1 n4 v; e* h
//背景颜色5 q& D3 L$ ~8 }+ M" U+ _( _
var marqueebgcolor="#FFFFFF"
% I) J8 `0 p% V* K* Q//是否能暂停 (0=no. 1=yes)?! m* a o$ O8 C/ Y
var pauseit=1
, F M) G& F! C
' G& B& W7 t0 d# e8 A//修改显示内容7 Z$ V1 p) T3 K$ _1 z
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'8 a9 q& w q. `1 r
+ b7 x W J0 b
5 h" t3 v4 G7 B/ w7 U' U////下面不需改变////////////
1 ]4 o j, @' r' B1 p% M* g z1 z# |2 S$ f0 R' W3 M
var copyspeed=marqueespeed
9 G0 V, e" B u0 C' _6 \6 S# Zvar pausespeed=(pauseit==0)? copyspeed: 0$ P! E( \) \" F" p; B3 G1 C
var iedom=document.all||document.getElementById
4 F5 S, B j7 cif (iedom)
$ g; Z& Y! S! x. @* \& X& B( sdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')+ F4 f6 V: R' Y' F! ]
var actualwidth=''- U* Q' P' w! B3 ?" Z2 h) ]! P
var cross_marquee, ns_marquee
# n o7 ^8 L0 O- U5 M6 E9 l# W6 [0 R* f
function populate(){; s6 g6 M/ r* [( E
if (iedom){4 x/ F9 e! ]0 O6 S7 X; R, j$ y
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
, T/ {" F% A3 q4 hcross_marquee.style.left=marqueewidth+8: s% [. k) H5 a
cross_marquee.innerHTML=marqueecontent4 C8 U: }& I: g; Y J
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
# d! x" i% t1 Y6 I( e}9 R3 q g0 C' m& C1 [' w4 c1 D
else if (document.layers){
. |- q) _ _3 u3 |" C0 Tns_marquee=document.ns_marquee.document.ns_marquee2
4 n; U/ U' O1 r$ p, A$ `8 C( ^ns_marquee.left=marqueewidth+8$ ^, C. \, f2 M/ Z! [+ y3 H* Z
ns_marquee.document.write(marqueecontent)
4 k9 I& ]! Z- p: d, yns_marquee.document.close(). B+ G, D+ n) I0 E0 M U: y0 [
actualwidth=ns_marquee.document.width, L- p ^) H0 y! T) g' E
}2 s0 Y; w( s/ e
lefttime=setInterval("scrollmarquee()",20)8 W8 |$ E+ ~; G, O, Q& n* F
}
0 Y# n7 V5 G ?" V$ M! `window.onload=populate
4 `8 U- K) V) M
% ]0 l. k) l( S l) tfunction scrollmarquee(){, E* u! Q4 h8 Y
if (iedom){
' T* L' F7 `8 N4 {- x7 [if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))1 u2 S' g5 ]* z! E* a8 g" w2 u
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
; @- o7 Y4 `) p2 y+ j4 ?* Yelse0 ?, f- H- K' L- M: Q
cross_marquee.style.left=marqueewidth+8
6 ^8 I' P% h0 Q6 X& E8 [! S
! O* m) d# @7 W9 U3 m& O}
% W8 c, ?, h( Z6 k/ z/ Y1 f3 O) ]4 \) jelse if (document.layers){
1 d+ O# Z" R8 c. ^" U3 I5 p! A1 w% ^if (ns_marquee.left>(actualwidth*(-1)+8))
" i J9 x+ P) i# w9 S2 qns_marquee.left-=copyspeed1 w8 Y+ g- u. w# ^, A. M/ v& d
else9 J) W; A9 N, X( Q% \+ a
ns_marquee.left=marqueewidth+8
) ^ g( j2 p6 {9 V# c5 _}
! ^& ]/ f/ q& f' M5 {( g! m}' R7 p7 }0 c3 D
* `8 y5 N) k* o# n, q3 Iif (iedom||document.layers){
! x. d: [1 ^: S2 n! z! r/ Bwith (document){
! e/ o; p# _! L9 r7 d+ R6 o% _/ [document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')6 S8 a! D5 P! d% P% c, f6 D0 p
if (iedom){
& X2 n6 U% r* \1 D* _, lwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'): j& f# w6 \& U+ ~) n, H& y
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
. A% N6 X" d0 Y6 u5 i: a9 B' nwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
. C: y( d) Y% C! e+ f. vwrite('</div>')
: l A0 Y, |6 {}$ E6 M3 t- e. t
else if (document.layers){
$ o6 ]5 i7 J3 V$ a6 y' rwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')( _' I' t) s K, Y( e7 p/ I) ^$ U
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')7 j, V3 _' m* S3 {
write('</ilayer>')
* _2 l9 \0 q# u7 D3 X( w: q' d8 }}
% M4 t( D9 o: \" p2 ddocument.write('</td></table>')
: s9 p( z" s6 l1 H0 v% w6 w' z) j}
' y* L. A' ~( d y) S- E}2 C. Q8 Z+ N$ N, p
</script> |
|