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

|
网页之跑马灯文字特效
//修改宽度6 M3 j* f& L7 @ j) Y
var marqueewidth=300
/ q# |1 [0 `$ c. y1 Q5 I//高度
* k/ y5 J" k, m. j3 e' Avar marqueeheight=25
- `7 v# l0 a$ B//速度(1-10)1 U& t. t [& s: v4 V
var marqueespeed=3
) T% d2 Y0 c) J5 Z0 i//背景颜色* D* o7 V2 Z7 z s4 x
var marqueebgcolor="#FFFFFF"
0 }" c& h2 W: n. K' m5 X//是否能暂停 (0=no. 1=yes)?
8 c5 L. e+ C; ] ]- d5 I4 Ovar pauseit=1
+ m: [6 B4 D! ]( x# ]0 C3 O+ O3 g0 }; b6 O0 w4 b& ^- J& ~
//修改显示内容
5 x# {7 D. f* N: h& T' L fvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'% R9 i& a/ c5 C% Q! z1 u. H
7 J* W$ |6 G. @, i4 p
- f* l1 C0 _7 T: f- D0 p1 E( B////下面不需改变////////////* e1 V2 Z6 M4 E6 n/ j
4 N$ e2 m8 q7 ^" C' k
var copyspeed=marqueespeed
2 h! r0 K% m) C! r1 t5 ]var pausespeed=(pauseit==0)? copyspeed: 0
0 }- _+ |/ ] c1 g" [6 L6 Y5 R) kvar iedom=document.all||document.getElementById7 {9 t1 O+ n8 Z7 B9 Q; g
if (iedom)' x& l6 Z, Y* s K# k' I
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
6 ^$ T& Q: i# kvar actualwidth=''7 v# v* G0 M3 g# W+ P! B' b
var cross_marquee, ns_marquee
8 d: Z* i Z* g( e+ b/ J7 K- G/ y3 A* o$ X0 K5 f2 B1 A
function populate(){; ?5 h- D0 R6 H; J3 x, \
if (iedom){. K0 u: F. s x* F, @4 f/ b @
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee D5 |: h- w* H% h
cross_marquee.style.left=marqueewidth+8
; V; J4 u' ^1 Z" vcross_marquee.innerHTML=marqueecontent7 e' v# _$ u- H3 W: m( Q: m
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth. _" Z W, i4 o; P% N
}# y O+ n, Z2 t+ O: J
else if (document.layers){
" {+ l1 N9 h% `- A/ D1 jns_marquee=document.ns_marquee.document.ns_marquee28 e4 \3 v# d4 z/ }: m1 n
ns_marquee.left=marqueewidth+8
7 a5 \4 U; u2 T+ J* ?' lns_marquee.document.write(marqueecontent)
+ i& S9 O- s9 n! r+ w* u6 E( [" ^# bns_marquee.document.close()+ u- B7 S4 D% B
actualwidth=ns_marquee.document.width
P, R, M4 ~4 o6 Z5 u}
% N+ i3 J0 U1 _, ?lefttime=setInterval("scrollmarquee()",20)0 q8 y$ @7 V. D! ^
}
( o* b% w4 w- I r3 dwindow.onload=populate1 \6 x5 E* f3 L
3 x5 x K) x# L
function scrollmarquee(){
! {( F4 w) V O/ B% Eif (iedom){
' v2 C# k! G$ O) uif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))$ z4 l; {( q) c* i# G9 I' L
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
* B# Q Z$ ^ belse
+ Y7 H R2 @! scross_marquee.style.left=marqueewidth+8
. M4 ~( Z, o# l" u. s" `
0 q+ j: D `8 R7 @5 A}
2 ^% F5 n2 }' y2 N4 {else if (document.layers){& b+ D+ Z! U+ a m
if (ns_marquee.left>(actualwidth*(-1)+8))
# C6 V5 F: L/ W% ons_marquee.left-=copyspeed
6 D% D) g9 ? U) L: uelse3 G* I, m8 i) E Z9 t, V
ns_marquee.left=marqueewidth+8' O3 @$ J# r f" ?
}
: u# r6 R. B6 M# Q- \" S}
5 b9 R9 b/ l& P+ W! l! {5 C; H) h
if (iedom||document.layers){
: S, f0 N6 [3 N; q5 rwith (document){8 T( Z$ a$ q# T
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
. B( T# @7 e. {2 |$ M6 yif (iedom){* `5 {7 d. a3 R; d' C
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')9 |9 Z3 t" j, P4 Y n" W0 G6 n( y
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
3 ?! M6 b7 f! C2 ?( c& N' }9 awrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
$ v+ Z# q6 ^% r9 j8 H4 dwrite('</div>')
" F W' q1 b) l2 Q" Q. i/ j}
" z1 p8 M+ o) t, }) b# ]else if (document.layers){
. Y2 T* @# N9 B0 j1 Dwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
" s* k4 q4 u5 c# T: m( t0 _write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')1 J6 D- U3 Q% G( G$ _7 s
write('</ilayer>')
1 `6 ~$ ]3 |" m3 O7 A}# b2 h7 D4 E3 n3 j/ ?$ w8 v. ]
document.write('</td></table>')
1 @$ x0 R) f; ^* K# K} Q/ I& t! X3 B9 x! T
}
# q! A- ]4 X# L4 S \3 a. F( s</script> |
|