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

|
网页之跑马灯文字特效
//修改宽度
a+ p, y$ U5 D8 h1 {1 Q. `- Hvar marqueewidth=300/ d( J( H) g4 {) f! O
//高度6 e- h5 ~1 |; J" i
var marqueeheight=25
' g: o* Y. U' T5 w" |+ f//速度(1-10)7 p- b: |+ U# }8 p: z1 _7 ?
var marqueespeed=3
- [7 {7 P# {3 H6 p/ K C//背景颜色
/ S8 E$ O. v: J9 R- ~var marqueebgcolor="#FFFFFF"
: ?4 G) n" e* `//是否能暂停 (0=no. 1=yes)? X4 R6 }- e0 l0 |, s+ ?0 F1 K/ S
var pauseit=10 V# f2 x+ G" r A* w' }
3 T1 G2 |" {6 e; b$ w' O1 H6 N
//修改显示内容
/ E* M2 P& [+ L, E) Fvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
! g; D$ r' R1 h$ ?- t) h
& {3 N! G s& y9 Y# r
- \1 [/ i9 i3 ?////下面不需改变////////////; |! T7 N Y8 e1 M
" t% b2 V% @ V" ]/ S( @! P, E
var copyspeed=marqueespeed
; R0 D% D; I) E; P, H) Qvar pausespeed=(pauseit==0)? copyspeed: 0
0 z- T' e: ]5 o" D7 | I9 e9 r# Kvar iedom=document.all||document.getElementById
1 M9 `: Z. ^' r2 a; Nif (iedom)
# S: A }* Y- s9 f1 {7 e8 U( L8 gdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')8 R# B; b/ b4 D# |
var actualwidth=''
. E2 ?. n6 V8 u/ Jvar cross_marquee, ns_marquee5 H" B+ {$ M4 `# u# M
+ V' }! D7 f8 i; s+ Z1 ^ q. L! g
function populate(){) ^8 d1 D! Y5 `0 ~
if (iedom){* q$ i7 s" m5 L7 M
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee! g/ q2 I, a' q9 l
cross_marquee.style.left=marqueewidth+8
2 a3 x' c6 A, P: I- u) dcross_marquee.innerHTML=marqueecontent
; m2 q( E+ ^2 _2 }" }1 L1 Oactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
! _) x6 Q% w& j- R$ v& e' U} T: m% Y* M9 l4 ?
else if (document.layers){
5 b5 S' P8 ~/ F* Q; p, v# ans_marquee=document.ns_marquee.document.ns_marquee2
* ^( X& R% i' B% X2 rns_marquee.left=marqueewidth+84 ]& B& ~& Y( L- b, B; y( b
ns_marquee.document.write(marqueecontent)
' X' ]3 L( e3 v0 l! s0 M1 O0 Ons_marquee.document.close() n/ E* c s9 S) h
actualwidth=ns_marquee.document.width1 @) f6 @# Z5 _) F# n. B5 ^! d
}9 [/ e- y! U, P/ O w9 o
lefttime=setInterval("scrollmarquee()",20)
+ {. c* C R' e* e) {+ V) y}
) g9 _' o9 W0 `! R! Bwindow.onload=populate8 B* q% V* P$ z" u' k# u
% e0 P" s! Z- R) q: j7 M
function scrollmarquee(){8 F* r0 N3 V S- J# x
if (iedom){" {& U! _, S% v8 `
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
# \8 A7 e: G$ o+ Dcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed$ ^5 e, c5 b3 J! X, C7 j
else6 t9 p0 N0 @! E) h; t; d
cross_marquee.style.left=marqueewidth+8
! i. o! H6 a: D
7 @4 d8 {4 A! |9 b}
. C. ^% R! |% v8 C; r# w7 D" v, Jelse if (document.layers){8 C$ z, K6 h% _8 D( d* R
if (ns_marquee.left>(actualwidth*(-1)+8))5 ?3 ]0 [; W( [3 y: d
ns_marquee.left-=copyspeed0 a& D' V' c$ K" [! v: O+ t
else/ r( T! S, Y1 X5 W- ^" a6 x( i
ns_marquee.left=marqueewidth+8
( D8 j1 N0 J, g2 X7 ~' j: x} u- z/ l# T& u h$ q" h$ B
}
& ]* Y2 v/ a0 P, @$ y l" q5 o, m& m, r) z4 U
if (iedom||document.layers){( }% |) ~5 t$ R$ H# V3 x4 _
with (document){3 N4 {: y5 A) J, m& V
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')" I6 h1 v- G8 p* Z o
if (iedom){1 L6 |( d$ W0 w- T8 _- ~8 Q# C
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
9 V. j* _! B) b2 }% C7 c0 Pwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')5 ]9 v8 ?+ ]8 X
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
$ B9 X$ N0 X9 T- r! L. iwrite('</div>')" H* D3 ~' R1 {8 Q; e
}
: d% F. G! _. r" celse if (document.layers){
( j0 D! k, x u" x# ywrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')- \- t- _0 R! V9 H Y* [
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')! c7 T5 y) @$ n6 ]% L
write('</ilayer>')
3 Z1 |6 b2 ]+ K+ @* j" B1 |}
- m8 ^, k- o% b% r" Cdocument.write('</td></table>')4 V) k0 d3 }$ k6 E
}
% Q+ M+ @3 B5 Y7 c n}+ f8 [, u. R+ G \) L6 p
</script> |
|