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

|
网页之跑马灯文字特效
//修改宽度
; P+ ~4 n8 f: ^6 |1 A8 p1 W: nvar marqueewidth=300: m2 _% o% P. M! U, N3 u/ L3 e, P
//高度3 w0 V/ V0 c) R
var marqueeheight=25
- {: w* s8 b( b; L//速度(1-10)
8 K& O" t' w8 M" r( a, ^var marqueespeed=3
" O0 r$ N+ T- o( K9 z: i% j7 u) p//背景颜色
; K& w0 Y0 Y: C% evar marqueebgcolor="#FFFFFF"
: U' k! u! d+ I. ]# E+ K' p//是否能暂停 (0=no. 1=yes)?8 l# m$ _9 r' ~( m4 N! k
var pauseit=1
1 p) U4 O" f0 @$ D f4 Z
1 l$ u; a# s- Z" ?& p I//修改显示内容. s- G' v( t( D% n! U- G
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
/ V6 n( q+ [- C5 X g7 s
* O: S5 }3 Z0 M8 Y7 Z! @" I* X8 {$ @% ~5 U/ |) Z2 k
////下面不需改变////////////
$ Q( j- x1 U! f& \# q
4 X4 f# O7 c5 Cvar copyspeed=marqueespeed
! `* @9 A! Y8 N; Q" D+ U, g1 Jvar pausespeed=(pauseit==0)? copyspeed: 0; p; A; P& M/ S
var iedom=document.all||document.getElementById
, i C8 V% d1 P0 ~' iif (iedom)
6 a) x8 z1 H/ l; Gdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')! D3 ]# a! d9 p/ `8 d2 ~2 L! C
var actualwidth=''
2 |, v$ m6 q) ?. N! p% a3 hvar cross_marquee, ns_marquee5 I4 i( E, Q, M5 x8 q; c! D6 j4 p6 F
& S; N% q$ Y. L9 G
function populate(){
% S+ w3 M2 s! \4 O' a H W: Dif (iedom){2 h9 t2 L! l) ?: F- U6 h, G
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
+ w9 ^! v( J7 i8 T& c w1 Rcross_marquee.style.left=marqueewidth+8
8 ^) X+ @9 \- Bcross_marquee.innerHTML=marqueecontent
* M; P' z! x5 C9 j; U, G: o8 dactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
0 ]9 ~- S! m5 A: t q} t' O w- B, r. t- G) [
else if (document.layers){
" [0 S- O5 P8 R2 A. Nns_marquee=document.ns_marquee.document.ns_marquee24 i7 h7 l& p+ c& ?( f
ns_marquee.left=marqueewidth+8 H X2 ?8 C: H L8 R
ns_marquee.document.write(marqueecontent)
& T$ M" ?) v$ U7 dns_marquee.document.close()
5 D" Y7 P3 J* ~. T6 M2 m& _actualwidth=ns_marquee.document.width- |6 A& N( I* C# Q. O8 p* ?" S
}7 D/ B( u% n4 E: t* M2 P9 c
lefttime=setInterval("scrollmarquee()",20)
% g Q. Q7 y3 l* x7 W}
* e" g+ M- l+ o1 X- f: J" L5 Hwindow.onload=populate, \* A# i+ {# ]. P, ]+ h6 v
1 g/ f: g9 o: G8 c/ c' L$ a
function scrollmarquee(){
7 p: s$ k4 Q ]9 Hif (iedom){
+ d7 a- Z: U; z: ]2 l: W6 tif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
4 d% V& ^) y' I& tcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
3 R3 w7 O+ Z: e6 ~ T$ Velse
. `& ^# A% A1 K& I6 F1 Jcross_marquee.style.left=marqueewidth+80 b7 d' a' T, K' w
& K5 Y, D8 V. a- c# M0 P7 r/ c}
( T- U- u( L' {else if (document.layers){
5 n$ ^( M' P) @2 o# L, B% W! V& {if (ns_marquee.left>(actualwidth*(-1)+8))
, D- L0 c7 t5 j. wns_marquee.left-=copyspeed
$ W, ~" k k/ b- a( m% F( `! x. qelse
$ f3 ~5 v- C3 J) Lns_marquee.left=marqueewidth+84 D- k* O& t j5 K% E4 r/ A
}9 j' i. b: j) I
}( t% `, B+ b4 K1 y
" E# @' c. y zif (iedom||document.layers){5 s8 s1 s' ^; `& x* z) y$ F$ ^
with (document){
1 l% \7 F, R9 ?" _6 Xdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')! Q5 h, U+ b) `+ j. G( t) U
if (iedom){
! |' F/ Z' h* K" q6 s6 m* O7 C- Ywrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')+ l! e; l7 T r% Z. n) F/ b2 I; I
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
$ b H$ K! Y. M* Lwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
6 {/ i! k% g! w0 e2 lwrite('</div>')
5 I8 E6 _: a9 j. Q% I, v0 K}
! h3 W; u; `- c0 X2 m8 ^6 A7 |% Uelse if (document.layers){
+ x% }* `: m# H5 l; p2 ywrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
; a) ^: B5 H; |0 W4 f3 b! ` P* kwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
% e) o0 A; n9 r! H9 G( Iwrite('</ilayer>'). u/ |, H1 @& N: D' }5 g0 O/ Y
}
/ p3 i8 z, s2 Z) }. Wdocument.write('</td></table>')6 L/ k) S# l5 |6 j* I3 g
}5 [6 ~ |; y1 I7 }# X. T1 r
}
4 Z% b0 r- t5 I, a/ j g</script> |
|