返回列表 发帖

网页之跑马灯文字特效

//修改宽度0 _- ^+ ]) G1 g( o) Q
var marqueewidth=300+ G: H) j- r/ F$ X9 T, U: R6 D
//高度8 L# Q5 f4 D4 z( ]! a- u
var marqueeheight=25& L+ ^# P, A2 H; a. n
//速度(1-10)7 h( g" R2 D9 e# T4 ^4 `7 t& d7 D* ~
var marqueespeed=3
- H0 C$ |; T6 Q( \2 j: _4 E//背景颜色
2 L3 k* Z& u6 E! l& }6 R& q8 o6 Kvar marqueebgcolor="#FFFFFF"3 o5 q; S" ~! C2 X" ?- a! Q
//是否能暂停 (0=no. 1=yes)?+ e) h1 B' Y. ?
var pauseit=10 [- ?0 ?) p& E
. i! o7 a- W3 r* w+ A6 R( n8 y
//修改显示内容
+ f' ?8 }! C7 f4 Dvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
! y$ m8 b) F8 U9 w
- q0 ~' ~& U& ~
$ [! `* ^, i, g4 X////下面不需改变////////////  H6 X) Q/ p- E* J+ E

: {6 K& d" ~" H. v# Cvar copyspeed=marqueespeed
  A& {& _) w8 W$ d+ yvar pausespeed=(pauseit==0)? copyspeed: 02 p0 i+ C; r6 l" k4 q
var iedom=document.all||document.getElementById& Z# b( @2 q% h, u5 b( r
if (iedom)
/ E7 n7 T2 c0 S' n1 ]document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')1 ]' U0 A( n5 ?8 I
var actualwidth=''2 {7 `% B, i2 A1 R: I+ R9 m! V1 v+ `, `
var cross_marquee, ns_marquee
, l8 o" R0 _+ Y, q
# y$ h5 i6 k: Y  I' Z- ~function populate(){
: ^9 N9 W1 A# f- V: [" Xif (iedom){
8 k' Q2 @" U$ I7 d9 F, v, across_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
) L" a% M6 }* M7 o8 S+ n, I, Scross_marquee.style.left=marqueewidth+8
0 V  R, S1 H$ s( x5 xcross_marquee.innerHTML=marqueecontent0 }' d9 \, L$ V* X0 u% T; N- D3 s
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
: S# j/ P- t) ~  A* h}2 A. v7 A1 ^$ v, l8 Y0 M3 q
else if (document.layers){
- X0 O3 \5 Z6 Yns_marquee=document.ns_marquee.document.ns_marquee2/ w8 p4 `4 K# V( y
ns_marquee.left=marqueewidth+8
( x: u. A& R6 `4 h: R2 D( }ns_marquee.document.write(marqueecontent)% E" ^' F. V9 o3 ]
ns_marquee.document.close()
; E8 |0 \+ d6 Z! e# jactualwidth=ns_marquee.document.width
* f  s* U( m2 p7 U4 h7 G}3 O! M, ?1 y. u. V" l2 Z& b4 f
lefttime=setInterval("scrollmarquee()",20)( Z* ], {1 X- c! ?( F0 g9 k6 y! d
}
" c& U/ N; |# y/ f* awindow.onload=populate2 {& A- Q$ R) N% T6 C, G* }6 o. p6 ~

0 `# ^8 D" y- r2 kfunction scrollmarquee(){, d4 F7 J4 X) C4 y* [( r
if (iedom){) H3 c  V2 ~2 B9 @
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
/ ?6 d, i* _5 ~& e* ^- i  ocross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
3 M0 u! Z- `- U" U( x% x3 \1 b! \else" F) S: t0 E9 c4 G. q
cross_marquee.style.left=marqueewidth+86 i5 w- d6 p# F% G7 w: M, M

# G3 C' q- S  R}: _0 y+ K4 z+ P$ r/ P6 q
else if (document.layers){
  W2 O" r7 T7 S1 G4 W1 gif (ns_marquee.left>(actualwidth*(-1)+8))
+ x: c6 W6 H3 l' V/ ]; l5 Uns_marquee.left-=copyspeed, N: T  g+ x2 Q. S/ @" \2 m
else
+ o* u2 z+ h4 h7 Z6 L+ ?, W$ Gns_marquee.left=marqueewidth+8
2 b6 I# c5 R. T$ R- ^# s  v' q}
: M3 g! l4 |" Z4 y}: a$ f. I! u9 B

1 _+ R/ J, S' S$ d2 ?: V3 Uif (iedom||document.layers){
+ ?# Y" a0 g. h) Dwith (document){
9 P! O  q$ f/ y+ Z" w' Rdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
/ m( R" u; E" K# Nif (iedom){
# L. E" }* u, Cwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
# S# r6 V4 e  ]4 pwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')- M& C) t' p- o- Z
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
4 z8 Y6 K$ a' {/ G' s1 S- v: b" y+ Uwrite('</div>')& u7 }# a- h/ |6 @9 q
}
9 k* @" z# S$ M, X* I/ W9 oelse if (document.layers){& L4 K  |& l+ t* K
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')1 V: F# \; h. J3 i
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')5 j5 o3 A* I6 k# V
write('</ilayer>')
# o( ^: z0 }/ d( j* U7 u0 R}
, h  u. z6 w8 pdocument.write('</td></table>')' U& G1 O" j* n: y/ S/ f4 K- b
}
9 H8 ^2 \/ I) D. t7 e2 x* D+ N}
1 H4 r+ u9 O. J1 v</script>

返回列表
【捌玖网络】已经运行: