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

|
网页之跑马灯文字特效
//修改宽度
Y5 l) b2 M+ z; l( s# dvar marqueewidth=3009 H- q' l; U" c+ j% `
//高度
6 z, j1 E# \1 e- ]8 ?var marqueeheight=257 b. n# K' t7 u5 g1 n
//速度(1-10)9 Y" g$ z) n$ \/ B9 c" ^
var marqueespeed=3& {+ |* h X F: {
//背景颜色
4 b' e% Y) u4 Z' l" Nvar marqueebgcolor="#FFFFFF"
' K& g7 }+ \/ M, ^+ \& ~//是否能暂停 (0=no. 1=yes)?
3 ]" i: f0 t' e* L4 wvar pauseit=1
$ x0 b! \: \7 r [, n L2 c0 N. u1 t% k* h/ r3 n
//修改显示内容 [' o, X" ?* |8 W- D
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'0 L4 ?3 U0 B' a5 `. `1 C
$ D$ {0 i5 s2 C
: p& O0 r8 S" a. I////下面不需改变////////////
$ [9 v$ b! Z M2 X6 l1 j: ]4 ^. E- H9 o; h6 e8 V
var copyspeed=marqueespeed
+ C2 p' M5 K+ w G4 R6 x% c( b. tvar pausespeed=(pauseit==0)? copyspeed: 0/ E W6 n1 h8 m3 t8 t
var iedom=document.all||document.getElementById( ?" }/ o0 V1 A; F* o1 m
if (iedom)
, _* ?8 E% @, O+ N4 W1 N, |document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
; A, v% X5 ?6 m7 G5 vvar actualwidth=''
' d3 l' ]2 z! K! f" {3 w! {# Kvar cross_marquee, ns_marquee
* Z& n0 F6 F! R" E. F7 s- f% j1 y( t( k3 c& r& D" ]" h
function populate(){4 d& y2 S: u/ G4 c6 ?+ x- [
if (iedom){
/ J8 A G6 b6 ?! p' \0 l3 dcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
; n; V0 A9 F1 I Ucross_marquee.style.left=marqueewidth+8; M7 s+ P% |3 M R1 q3 J
cross_marquee.innerHTML=marqueecontent1 T5 s- k, t) K q
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
: ~5 }" b' h# [* ?0 f3 e}
; n* e4 [: T+ V" u6 f7 gelse if (document.layers){7 b/ h* Z. ]! E* z5 g6 N+ }4 Q" s
ns_marquee=document.ns_marquee.document.ns_marquee23 t4 r' m9 u9 P- p) K n& f$ A) p0 W
ns_marquee.left=marqueewidth+8 u1 F9 S6 h* z3 C# ^0 m5 _8 C* {7 p
ns_marquee.document.write(marqueecontent)! j) {! A; b, a8 _8 Y
ns_marquee.document.close()9 ^4 K) {' Y1 \& ]/ m7 e5 ^
actualwidth=ns_marquee.document.width% v* O. h% C' f+ C; a3 v( J- D+ |( T V
}* [* r" i3 v" t: o' _2 }
lefttime=setInterval("scrollmarquee()",20)% X0 _ }, j0 l
}' e. y3 E; ~3 s) b; v6 j! n
window.onload=populate+ d1 J$ x+ N! a+ g4 [! d w7 e
, p. _8 X3 G1 V
function scrollmarquee(){
, h- T# d* n/ ?% b6 I6 Kif (iedom){
4 b3 q* n' J4 e# I4 v' `if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))7 _% I; R b. ~: g/ Z
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
& K4 z" Y% _) R+ j6 W) z. w9 Qelse
8 i& F ^2 J# m/ ?# N: e, Vcross_marquee.style.left=marqueewidth+8
- b# ~; h& V* \3 i
9 s, ]8 w4 s, f}
- X2 q, T, L6 y/ D7 Melse if (document.layers){- X% { o' x6 ]# @ c, I
if (ns_marquee.left>(actualwidth*(-1)+8))7 @( J- W M, c
ns_marquee.left-=copyspeed+ ?9 g" L8 G. X7 v' B- W) X
else( o- Y0 j% {; _) k
ns_marquee.left=marqueewidth+8. _' I( }! G1 |& V
}
) g2 ~. N! H3 t8 W}
7 H$ x$ v2 [* G: r1 ?2 A8 {
. Y; |2 V( l* e% M- Xif (iedom||document.layers){
6 |8 x6 r, V" n# O! r, ~; E2 rwith (document){
0 K6 Q' z# S- ]$ N( J+ g& u9 ]document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')2 Y6 R3 Y$ ~4 W8 _
if (iedom){
1 _2 R0 {% r+ c. _ h) c: gwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
! h4 e1 e& Q! @7 {write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
2 W5 W+ a2 x% |3 R; G8 w( Zwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'), g2 T: A7 I) x2 ^( Q3 C5 ]
write('</div>')2 |! i- M8 g) @5 {3 v# \
}, |2 \5 C; p! Q7 O) S
else if (document.layers){
$ {5 w/ Y9 T0 V2 l9 q" J. J" {write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
$ {7 ~4 f$ R1 j3 E. Awrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')* F. L" E! a b" l
write('</ilayer>')% b) |2 r7 W, T4 I
}3 u: g0 A. D- B8 I; J
document.write('</td></table>')
3 G9 b& W; l9 J( S$ N}
. @% o# y2 M5 l6 k9 b}6 o3 c" k6 E s; Q$ {! x1 Y! F' x y" w
</script> |
|