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

|
网页之跑马灯文字特效
//修改宽度
0 Q+ o8 Z7 ?" k- O! ]: mvar marqueewidth=300
/ Z% _9 b! ]0 ]//高度9 [, j3 R% f0 z. ~2 J. w1 a8 Y
var marqueeheight=25
6 R9 @; D6 p- Y W! F$ u//速度(1-10)4 [/ b9 T# S0 F P' e4 g: N4 Z
var marqueespeed=30 k) b1 J% A0 @6 M% R) }2 j
//背景颜色/ s8 q7 H! S% W; X& s( T
var marqueebgcolor="#FFFFFF"
9 y2 {2 W* Q2 X) M. u& v//是否能暂停 (0=no. 1=yes)? J% A( Q! W% [# F( o
var pauseit=1% L+ h# @. c# [, n$ C5 e2 U8 { R
9 u2 z& o0 A# M) G" ]# M* l
//修改显示内容4 S$ |4 b+ q1 o+ ^( j G3 z5 F
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
) x! @- t2 E9 k3 O1 r3 n/ ]+ `! \, l" y1 H% T( y
8 e' k3 M B `2 u1 s( Y
////下面不需改变////////////
& V! W' i% L2 @" D' A3 S/ r% k# u( y+ v
var copyspeed=marqueespeed
4 ^$ n3 v: A# c, |+ Fvar pausespeed=(pauseit==0)? copyspeed: 0# f2 Z7 K. u: `7 b
var iedom=document.all||document.getElementById/ ]; q% N, x4 J8 e+ G0 {- S) P1 c
if (iedom)$ W# g! H: J4 M
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
/ Z7 u( n5 ?! m( X6 M3 Wvar actualwidth=''
$ _1 h# ^( X+ h+ |: X9 Ovar cross_marquee, ns_marquee' \* q* L; {) [1 ]$ o! ~# d& i5 } ]
/ g. S3 b4 C! ~2 N& _" Wfunction populate(){
% e% @) |" ?+ t0 Iif (iedom){+ L: F$ _" T1 K6 u- s1 B
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
' R) {" \. S. Tcross_marquee.style.left=marqueewidth+8- V3 `! k/ @5 Y2 ~% e7 {6 e
cross_marquee.innerHTML=marqueecontent
, |5 Q" a0 q# A/ G. h) ^8 ^) Tactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
. \2 Q& `" e2 |9 n3 j3 _2 d}$ T- n. G" E5 r$ u0 {
else if (document.layers){
$ D+ W) B+ L0 lns_marquee=document.ns_marquee.document.ns_marquee2, ]! R. ?# S7 q2 C/ u
ns_marquee.left=marqueewidth+81 t1 l _* S# P; a/ n, v! O( E
ns_marquee.document.write(marqueecontent)- ?% ]" n3 m8 }3 P
ns_marquee.document.close()& t' E% X# C! C ]# a4 Q5 c
actualwidth=ns_marquee.document.width
1 v' o& y8 H* |}8 e, H& S$ f9 K/ z3 @/ B1 _
lefttime=setInterval("scrollmarquee()",20)
& {$ z8 ~, Q- \/ q}
0 F/ j/ I5 O% T9 I0 U, I$ iwindow.onload=populate
% x- s! X p9 B/ A. R
* n9 [- |8 w- _$ b1 T: [, ~' q; }- tfunction scrollmarquee(){4 m; O) J, P. H6 e, S4 i! {7 y
if (iedom){
4 o" ^, R* f. L( ~) ^if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))9 k, e, p3 T& K9 \. [ s0 V7 S$ Z
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
/ L- M6 |/ B( E4 [2 [else4 W' }" w0 H1 d( N* f' A4 n: Q
cross_marquee.style.left=marqueewidth+8" E* S4 d2 f4 [2 n8 Q: W
2 a+ m8 X) U0 K0 X
}
x @! D6 v( v5 h/ selse if (document.layers){; D6 _+ c) d. A
if (ns_marquee.left>(actualwidth*(-1)+8))
" S, I) y; s C! Y( K* j3 q" Yns_marquee.left-=copyspeed) @$ l7 |( x& d3 T3 i W
else' F! b. S4 a7 K6 W' q
ns_marquee.left=marqueewidth+84 O- n$ r: P* U$ ]# d
}
" ~1 a! |# J# C* N}3 H6 ~" H# n( @! P+ ]
5 p; R; D! D& @ E" E5 w. {2 |) fif (iedom||document.layers){+ y1 V6 T1 b+ d. }
with (document){
0 X/ s, t; g! x' d4 h0 edocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')# p( S e: ~4 e
if (iedom){
0 w3 f1 W# l- D% ?3 kwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')* H8 L4 b; L5 D. n7 p- c, ?2 p2 D
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')2 S# ~4 X) k( w8 Z' a: ]
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
+ S$ Y0 K) [- Z E+ uwrite('</div>')
c* v/ `& O) I' _# }. d/ C}
: y2 Z7 P% t( R$ ]. nelse if (document.layers){
9 q( a" ^4 k) t x! w U' @0 @write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
9 S$ j6 i$ p7 q( m. ~' nwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')% L8 p4 A, d" [6 Q1 b
write('</ilayer>')
( Y3 ]2 q+ e i2 ]; t7 O}
7 b' c6 }/ [4 R6 |- |% i- vdocument.write('</td></table>')
) m1 d& b% t% y" c, q% T}
- |: a. v4 T9 {+ O}+ c# `6 u2 T8 D, x% C1 R
</script> |
|