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

|
网页之跑马灯文字特效
//修改宽度6 r0 n) D4 G" i/ a1 n4 G" `
var marqueewidth=300$ q; E8 ], q1 M+ h5 i1 s6 w: ~5 t; X
//高度: X4 D- o! U3 V
var marqueeheight=25
# X5 v$ L8 S( o- s2 P* e" M//速度(1-10)) v% c0 r5 b9 a* J+ c3 x
var marqueespeed=3
: Z# x% l% v9 j1 l//背景颜色
; k, ^' `( M) J* x. M ]" t* H- Evar marqueebgcolor="#FFFFFF"
" H d# k& p+ C* A" b) C' {: B8 V//是否能暂停 (0=no. 1=yes)?
3 G/ @: Z- h1 U5 u8 nvar pauseit=11 \+ V: E( A7 P0 \, b- ?
( C) Y0 ~* T# t# T
//修改显示内容- r0 F) |- D1 o' Q- R3 z; T" M: v
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'- \1 H' Y/ t. E& S7 e
0 ~% J2 c% _5 N* ^" H+ Z8 F! [& V7 c' c7 e& Y, P" U
////下面不需改变////////////! C. b9 ]. \( Q1 o" r
1 G; R# C; J- r2 {6 D' F: C( L" Uvar copyspeed=marqueespeed
?1 e- d" n+ e1 Wvar pausespeed=(pauseit==0)? copyspeed: 0
5 m" k1 e1 o% h1 O4 [var iedom=document.all||document.getElementById
" N$ V f* g9 i) ?if (iedom)
9 E+ S5 Q# z' idocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
$ S* `, D, T& b4 S. ~2 L4 evar actualwidth=''1 g" Z# S! g* j4 u0 ]! z& y
var cross_marquee, ns_marquee
# S; W4 h( s7 M) {4 J, T* i7 |2 R+ u* R- ~; A7 n6 K
function populate(){
2 w g, s, e- N. |+ @1 N' |7 _if (iedom){/ j+ ?* G B# r# J/ c; I1 z2 s
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
* u3 E* Q1 B4 A: Z0 m- tcross_marquee.style.left=marqueewidth+82 m4 n5 H! w! A& ?* r
cross_marquee.innerHTML=marqueecontent
, n& d4 M6 L8 K: F* g6 Q1 M5 tactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
, ^# d; G. v3 i, F5 ^; W}
3 Q2 H* B6 q( s8 eelse if (document.layers){/ b, i8 D R/ g
ns_marquee=document.ns_marquee.document.ns_marquee2
1 c1 V, p; V0 F0 \+ |ns_marquee.left=marqueewidth+8
6 ~2 y1 D% `1 hns_marquee.document.write(marqueecontent)
4 ?$ @; B: f6 l# [ns_marquee.document.close(). j, E0 b" J4 O2 p5 y) Y7 [2 \
actualwidth=ns_marquee.document.width
- j/ @" |4 ^4 E2 m}$ C- g% h x# T- E% h0 m
lefttime=setInterval("scrollmarquee()",20)( C/ y. j* j! P" _
}
. Z/ [& h- v% I& V3 nwindow.onload=populate
) |6 l F, P5 e5 B$ e% k& t. d, v) t J* P1 i
function scrollmarquee(){4 ~+ q \ \5 G
if (iedom){
5 ]8 x$ \ q# U" u) H+ e+ T) Dif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
3 S; D; x' w* m: t- }cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed0 b) `) @ K- ?6 |# k
else& e& S" u5 ?1 k' b; H3 ]
cross_marquee.style.left=marqueewidth+8
' w! E9 N6 H+ @& H) X3 T# p1 Q" b; O, J+ K5 L- A- U; g4 G7 ~
}
: e3 Y9 {* a! u7 ]! I" B, B# q1 velse if (document.layers){& e P6 S8 V& {* F- a* J
if (ns_marquee.left>(actualwidth*(-1)+8))
d5 M% ~4 q v# mns_marquee.left-=copyspeed
- _. Z; H% K* k1 r' n! {9 selse
: x* M( Q' \' }) \- g' ?ns_marquee.left=marqueewidth+8
+ L$ x0 q9 H* z* C}. R o2 E+ U: o/ W" [
}0 q& E! |1 x' Y5 P: ?, z
2 A& g, J& h. R+ `; J
if (iedom||document.layers){" g) F( }3 M6 c9 F: E8 B
with (document){4 |0 z U3 S- @( E
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>'): v0 P {7 V5 Q+ D( T3 T
if (iedom){
7 h& x! u: }. ]write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
% N( D1 J0 |7 y' T( `write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')8 v. R: Z8 H6 T2 i' K" X
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')5 T0 ]6 I S- }' {2 u
write('</div>')
* J1 E. C* L6 ?0 U' N}. |* a/ {( M5 i' |2 Z$ Z
else if (document.layers){
# s7 C& ^, _$ R" ?write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
" U R( E; p! ]$ owrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')7 C/ Y' B9 ~* g
write('</ilayer>')2 u7 L L7 `2 T" c7 D# H
}
0 f: b$ _, M! l5 O5 a) L! Vdocument.write('</td></table>')& [) ~3 S( {' l4 {
}. ]# L$ m9 R1 y8 {9 c G! z
}
5 G- ~ V6 \+ C1 ]7 q' [" m# F</script> |
|