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

|
网页之跑马灯文字特效
//修改宽度 Y: `; e" o' N! i3 ^* U# N; v
var marqueewidth=3009 [! P: T Z5 L2 O, }( r
//高度
" W, i% Z# z* S) s' j$ a; yvar marqueeheight=25
3 _. H& B, A/ n5 O//速度(1-10)4 M* ?, w" G" [* D+ k% ?" q
var marqueespeed=37 e& g) ^ R# a6 ?+ z8 a; v1 ^
//背景颜色
( S2 L2 {' \" N8 F3 ~0 Nvar marqueebgcolor="#FFFFFF"
! b8 F$ R U3 a0 j4 b6 i+ k//是否能暂停 (0=no. 1=yes)?
K! f0 ^& M: S& k% X+ `var pauseit=1
( b, O* \' b8 t4 c$ e* V/ x' E* R" x9 c3 D
- D" W4 `5 {3 \2 ?//修改显示内容
9 o$ B$ d: |$ P. B6 h( m6 V2 \var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
9 h. ? |- t! C# n6 a. p2 s# _' @/ {( [6 ~5 n
! {( W& K, z/ v1 e/ G////下面不需改变////////////3 G `7 Q& n$ P$ ?
; g; f; k8 P f% g$ h1 Y! z
var copyspeed=marqueespeed
- _8 n6 `6 }3 F: [# Q* lvar pausespeed=(pauseit==0)? copyspeed: 0 ~6 U: l" {9 O% @2 \/ q }# g
var iedom=document.all||document.getElementById9 Q. O& n( I! l, R }
if (iedom)
" T& `/ X0 W- B& d1 kdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')+ c* G1 j g* v3 s3 m9 e! y
var actualwidth=''7 o/ m0 [- ^0 u y/ s
var cross_marquee, ns_marquee
* o! u2 \7 ~! q4 F3 J/ J5 F% k. g( L% R) `+ p% b5 E
function populate(){
% K( H( Y# B/ F4 Q7 d5 Dif (iedom){
) o7 S) K s- ^3 e7 m" G" E0 O" Qcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee$ k0 ?. q0 p- B$ ^
cross_marquee.style.left=marqueewidth+8) n# A6 ?+ V# v' K4 k7 T
cross_marquee.innerHTML=marqueecontent2 ?$ o9 K' p* D$ A6 X
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth- d1 z1 K: [+ N' A+ a P
}7 J: W4 h8 e& { A6 G
else if (document.layers){" K9 W, {. D4 x
ns_marquee=document.ns_marquee.document.ns_marquee2
0 k% H! @0 [9 U7 t' yns_marquee.left=marqueewidth+89 N# S& D: J p2 O% L c
ns_marquee.document.write(marqueecontent)0 a D8 O( v7 i8 X8 S$ `
ns_marquee.document.close()
2 R9 W9 Q. g7 gactualwidth=ns_marquee.document.width
4 s9 D5 U" F- D; `; N J, T7 ~}
) q9 d0 i" w z- y/ e) dlefttime=setInterval("scrollmarquee()",20)
6 n% f8 G' b( H) W& X}3 b0 F: h- ]$ j7 J3 F% ~5 w
window.onload=populate( m; I0 m! a, b9 ?* o2 O
& h& W3 N' V! E5 @0 D) b' b
function scrollmarquee(){
( |+ E! S1 ^6 n( S4 l; ]if (iedom){1 C# \7 }0 D, x9 H/ ?! t
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
) t1 G* X5 S7 u: c. Ucross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed8 k: T, E2 q9 i
else/ E9 D y! G! j( ]0 i
cross_marquee.style.left=marqueewidth+8( E' Z( t9 S8 k, K# I$ H" ]3 M) I
, n% _4 [* y% p- |1 I4 f; p9 J}0 y) g# b2 V! q7 G, c
else if (document.layers){
6 K) U1 L' N6 ? m3 J* p1 _if (ns_marquee.left>(actualwidth*(-1)+8))
/ f2 F: e( Z" U2 D# Fns_marquee.left-=copyspeed9 s: b: L' m; K3 y/ [7 h
else) b! c1 _; H* c+ L. ?6 ]
ns_marquee.left=marqueewidth+8
4 S7 h; `' M6 z! S0 F+ w}
. ?0 d: O. ]9 H# H- u* u}1 e/ y N% [2 |% d! T
+ g# g) E- A7 F% R5 W5 m$ Z: Jif (iedom||document.layers){+ R' m6 b( ]5 m2 Q+ u( m/ r" _
with (document){
. M u# W0 k- u8 B5 gdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>'), |! x4 ?. S7 N; i
if (iedom){
' ]4 v8 V; J6 v; Y) G! s5 H, bwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')6 i3 a) _' w6 V+ R: C9 P$ t
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
# s' E9 X. o' {5 ewrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
! ^3 \0 k; a' i1 F3 z- W0 c8 Zwrite('</div>')# j' K% y& L3 T. {( j& s
}
# P# L- x1 m- K J9 T7 _# n4 o0 u& delse if (document.layers){" | H% u& S$ z6 }) B3 Y
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
. u+ \9 O) h0 I( @ p9 nwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
) b) C+ D: k3 ~" N# N. {) Kwrite('</ilayer>')
9 j1 k' b# x$ V' w0 i4 J6 ?4 Y}! j. i' E6 N v6 x9 e
document.write('</td></table>')4 J. m1 \4 N9 Y6 [
}* x7 X/ {+ l% ?& z" d
}
5 s: [- A4 i5 N; r* d4 t</script> |
|