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

|
网页之跑马灯文字特效
//修改宽度, j9 d; y. d: }! T/ v% ? E( \
var marqueewidth=300
; w, K5 P6 Z7 C0 Q) U# t//高度
" J! G1 I! `4 L/ @5 i4 Y) [var marqueeheight=25
9 {( B1 I8 q8 B//速度(1-10), M+ E+ p R0 j$ P! t1 w
var marqueespeed=3
' u3 e% \- `! g) L//背景颜色6 S0 A1 G2 E, `& u
var marqueebgcolor="#FFFFFF" y$ q$ K/ i6 |$ ~* u
//是否能暂停 (0=no. 1=yes)?
/ h$ s; m K1 `' q' H$ |var pauseit=12 Z3 d, } l9 r( G5 E" X, F( ~
2 l8 _% \$ _6 U0 x, k: K8 j
//修改显示内容0 ^- @4 H# ]9 M# a
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
6 r$ k' F1 _8 @) r
! n, Q+ K0 |8 W9 C* L5 [+ |3 ~3 S4 o, _8 |/ e5 _# U+ M, n8 u
////下面不需改变////////////
. ~$ s7 ?5 o' d+ M- o2 r
. G; d9 U2 G6 ^* o5 W# S+ O, D; Bvar copyspeed=marqueespeed+ m- R/ s1 f }4 d1 A( ~1 O
var pausespeed=(pauseit==0)? copyspeed: 0
! O) ?, |) Y% H9 Zvar iedom=document.all||document.getElementById: [/ u O( T A. S) Z9 b; H
if (iedom)1 u, o3 ~$ I3 v" k1 B4 z
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')0 f- Y- R/ X9 z0 \
var actualwidth=''! `! y3 o% b( z7 s* U C
var cross_marquee, ns_marquee) a) a$ Q% P& C- ?# C+ k2 e
( B8 G+ `& G3 J- Y" |
function populate(){ @# n, \! X9 P- U% R8 Z c" ?7 q4 z
if (iedom){
% i5 S- c# K) L& J6 `! ocross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
5 L; A' Y% S9 f/ I" bcross_marquee.style.left=marqueewidth+8
+ f9 |4 S' m/ P- g# B3 L6 H2 ]cross_marquee.innerHTML=marqueecontent; \# w% M' A. F4 z
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth. K3 Q: x/ g: X% b
}/ J! E( w, G) Q( ~
else if (document.layers){
, `' `' G6 H& V: H/ Pns_marquee=document.ns_marquee.document.ns_marquee27 A1 x R8 G8 d/ G8 u0 c* L
ns_marquee.left=marqueewidth+84 o3 {8 I" H3 P# j; E
ns_marquee.document.write(marqueecontent)
! J% [9 A5 Q9 C6 A' B, K0 tns_marquee.document.close()
; u) K8 O. S$ f4 \actualwidth=ns_marquee.document.width
6 [' V; w1 V( D! p% q, g}8 _' u; ?( H7 U4 M; F6 D5 w
lefttime=setInterval("scrollmarquee()",20)
U5 @! U% I6 D1 N- N( ?& E}
! b7 u! `% g' e p9 vwindow.onload=populate
5 c4 ]$ g, `8 U+ o+ J6 w4 }' e( I* `8 f, Z
function scrollmarquee(){
1 a5 r2 ?" |( e8 Hif (iedom){
/ c/ m, F( h& _, vif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
: ?8 S, U+ i6 X& h0 h9 Ccross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed5 T: e: y& O0 W( ^; k
else: r' m" r) X# }6 z- m5 c" O) z( ?
cross_marquee.style.left=marqueewidth+8
: g! p) R+ r% a8 Q- R% [7 ?* q0 ?8 X0 @
}# z) {4 h7 w0 I1 |
else if (document.layers){, n( M% B4 A/ Z, l
if (ns_marquee.left>(actualwidth*(-1)+8))7 e! T/ _8 D& H1 l4 M8 w# r5 P
ns_marquee.left-=copyspeed
; q- Z7 v0 e( Q' g, S0 selse0 B8 S5 w. o/ a, N: r7 q5 B8 E
ns_marquee.left=marqueewidth+8$ ]* k' A! N" W# `% t$ H
}9 I6 c1 ]: r; P5 ^0 G) R- {
}1 w" m- k0 l6 S7 R# E
* ~4 Y" e) @% n. {- e: w
if (iedom||document.layers){
3 c- P r" P& s. W: \with (document){& A: E3 c7 v5 T) ?' k
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
% j% E [* P0 R$ L2 O5 k/ T4 Jif (iedom){- W6 |7 m6 W9 V, `) u
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
+ @2 z, u; S" T+ x& B8 ^4 ]write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')3 V& _6 V( {4 F% Q/ y5 \, n& {5 |
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')( _# R7 y3 L' D( n V; r* u# T
write('</div>')
4 ^$ @: f, p/ K. ?2 @) s5 t}4 o+ G) D1 t6 R1 V) S* K/ p* j) {2 ~4 u. @
else if (document.layers){1 f- B( h( D& _5 w0 t+ H( m
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')( t9 C* M0 b4 r7 H
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')! O7 d; ]& T0 M
write('</ilayer>')
$ }( s& U- t5 d" ]5 Y}
) S. N1 K" r" S$ g# n6 v7 ~0 ?* Bdocument.write('</td></table>')) a, W+ \; E: x! C o
}& C% U$ U! p! o. D7 N8 h. w
}8 |% M2 }* d! H* R% l& }" S
</script> |
|