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

|
网页之跑马灯文字特效
//修改宽度# L! i3 s- s. U1 ]- f! G1 E9 M
var marqueewidth=300' J0 T' V, a; j, T
//高度
. N9 y% @2 v/ @var marqueeheight=25
% @1 Z% D+ P! F7 v, \4 y: c//速度(1-10)
1 S8 E; E+ {' s( o" Evar marqueespeed=3
( v6 N6 n" E& Z% ?) q. @& Q$ g//背景颜色9 ^$ Z: N! S" L; H6 O5 e
var marqueebgcolor="#FFFFFF"1 `) \/ c" b: s: [5 w
//是否能暂停 (0=no. 1=yes)?+ `% @0 S' I9 d% w. w2 p( H
var pauseit=15 g2 q2 f/ T% l" O) E& `
2 b" k; _- w. I' m/ f( h# i//修改显示内容
S" ^3 m" L0 D2 F6 _var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
+ j- |9 L8 |% ^' Q, @# e1 V" y" h$ f" W0 c8 Y: H: e0 g2 V6 Q
& o. }/ O d$ j' _5 i2 e" e
////下面不需改变////////////9 R" R1 L- [/ E/ k2 U( {- M
; c. |# q& K; b3 v% N: R; S
var copyspeed=marqueespeed V2 X, V8 g0 M. p7 w
var pausespeed=(pauseit==0)? copyspeed: 0) R4 \# j9 `& h+ n/ V
var iedom=document.all||document.getElementById0 n. x' o: F) f: Q% _# @+ U8 ^) Q6 j
if (iedom)
7 H/ O9 j$ p4 d4 p9 B: @document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')* t$ v" G, \' |0 h) X- p$ N4 [6 x0 S
var actualwidth=''2 A R% c# s! B0 y9 R
var cross_marquee, ns_marquee
3 J% b$ f0 M* i/ e. n. M) |
1 V2 @' f2 L z$ g2 [function populate(){
$ Q6 u1 B% t6 ]/ \; n/ v% X' pif (iedom){
; X& Z: F, b# e0 Z$ z$ dcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
! D0 j! O3 e2 D8 i* e% N) tcross_marquee.style.left=marqueewidth+8
5 G3 q6 C1 j0 e% ? L/ Jcross_marquee.innerHTML=marqueecontent
" `4 C2 y( D& x& E/ v& W% aactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth1 r5 }6 ?7 X# O6 O2 f
}7 k: b6 c. ?# b2 O8 W" P
else if (document.layers){
" T3 s6 H- Z7 y; L. Sns_marquee=document.ns_marquee.document.ns_marquee2
+ G* K5 `$ r) Q1 S" Q Wns_marquee.left=marqueewidth+8: V2 {6 c1 i' `9 @9 k' U5 N8 y
ns_marquee.document.write(marqueecontent)
* W& F# i" ~! O4 u7 c6 gns_marquee.document.close()& B4 R$ e+ M, ^" ^: X+ n2 e
actualwidth=ns_marquee.document.width
, }5 Y! X2 C2 ^$ ~# F ?}6 O* B. A8 F1 g' A/ e& m9 ~
lefttime=setInterval("scrollmarquee()",20)
9 j+ w) U/ y8 h6 d8 P0 Z}
, z1 c4 e; D! P: u9 d# a7 e. M( Owindow.onload=populate9 Q' S, ]( `% e; ]7 u
( A& Q9 Y# ~9 I/ vfunction scrollmarquee(){
4 F0 Z: Q! |* pif (iedom){
3 D5 H w' x$ |! _0 J8 Kif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
5 o" O, P2 m# ~* c( O9 x7 ]cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed! Z O9 B9 j+ S- s" v# l3 [2 ^5 X
else
- G. R# \7 _+ s4 X D/ w0 Kcross_marquee.style.left=marqueewidth+8
0 {% W9 H- u! O" f: E/ F
9 w+ w2 [' [' W! W8 {}
0 o4 |% M# M/ ?. y: j) ~6 M" [else if (document.layers){# n* c8 ?8 n0 F5 _' W; Z, C1 }& p
if (ns_marquee.left>(actualwidth*(-1)+8))
9 N1 S- y3 [ v: \7 W) y) V; lns_marquee.left-=copyspeed. Q0 `+ P. e3 v; p! J2 g( J: s
else
( Y0 B$ p) ?; dns_marquee.left=marqueewidth+89 @; A5 n- R- f' _
}
9 m% w9 M% ?4 b/ M" n' F% W! O}
3 q3 d' ^# W. {. ^# h5 J3 X2 Z: q3 K$ f9 J8 t$ ]. k! e/ n
if (iedom||document.layers){% G; P' b$ q K9 q7 _# O
with (document){; g! {: J; s% T0 N
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')2 n6 c0 y5 \& f6 _. c3 `2 u
if (iedom){/ f; ]( A: C% l5 f* n8 C
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'): g$ g4 q! w7 H# o$ }7 [3 m6 H' U
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')+ W- `) r1 q- ^6 C6 K8 J
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')- ^ ^3 f; H: B0 h
write('</div>')0 O/ `3 ]4 N0 v; j5 f0 n$ l
}
) x1 H( F* J% ?1 w3 j/ ^0 }else if (document.layers){6 [6 p5 m( k* V4 j
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'): R5 R0 j) S2 J* i# I1 O+ g# }1 S
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
% j W# u; ]5 p7 d T% d5 T" Gwrite('</ilayer>')/ T4 N/ l: T% ?% B; \# _7 }
}! `1 c5 k; G" o, e$ g5 ?
document.write('</td></table>')
/ U1 ^- A. c! f# X}
2 W8 T% q+ p4 S" U Z, L}
& w V1 i% Q! g! W# A7 t</script> |
|