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

|
网页之跑马灯文字特效
//修改宽度, M1 x0 ~( h* e; `/ E4 j
var marqueewidth=300
! D4 D; F9 j5 O7 i% s6 {//高度0 R3 X$ v# W p/ S! s) T
var marqueeheight=25
9 c" j3 h5 i! ]5 k& E//速度(1-10)' p, a( ] r/ y- n
var marqueespeed=3
' e c. L3 o$ k& \//背景颜色
" T- B3 w( t( @0 y" Wvar marqueebgcolor="#FFFFFF"- { O! w' ~# @5 |: ~8 H8 G" [
//是否能暂停 (0=no. 1=yes)?
/ S; g6 G' i0 d' Wvar pauseit=1) w# g% m: o9 w0 K
8 T$ a( L) V, `2 c# i& ^/ ?//修改显示内容
) G0 R" P L5 @% ]& R7 Evar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'! D3 F: u2 |% d, {: b4 {- s- r3 {
6 R3 Z9 `9 l4 l7 T( c- H) R- B% e' N. ]' d
////下面不需改变////////////* Z" R6 v, v# [' ?1 m% ^
: A9 s$ X/ \# s) B& [. A
var copyspeed=marqueespeed
4 m$ T' L( ?, vvar pausespeed=(pauseit==0)? copyspeed: 0) W% g- c/ A$ e# |* b2 U
var iedom=document.all||document.getElementById1 c; p! S* E* g) N
if (iedom)# `' x9 U6 z) F/ B }; \1 T
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')6 {$ ^& X! C% \% H( o7 F2 B U Z
var actualwidth=''
6 x9 F* ^/ L& Y0 hvar cross_marquee, ns_marquee% f+ I! x# S; Z/ @9 y+ f
4 o. |* o, j& Z( v( T8 R0 f4 ?9 Cfunction populate(){
0 s* m9 m v$ T7 d; l/ M) \if (iedom){
; r0 w8 |0 o: e1 e, k4 u, ~0 xcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee) k/ U% r* Q `( N+ `
cross_marquee.style.left=marqueewidth+8
$ h; }. g# e! ^$ D- l3 E/ m7 Rcross_marquee.innerHTML=marqueecontent
8 l! |. C& F- `+ M! \! ?, ?2 O& G Ractualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
' \2 j0 l' I% M% m- k* q/ X0 n}
5 m& {6 @+ {2 u0 selse if (document.layers){
" }" V+ a4 f* k' V) Cns_marquee=document.ns_marquee.document.ns_marquee2
% H1 q+ W0 U8 ~! I+ s5 X' n: tns_marquee.left=marqueewidth+8
. h$ t/ X1 ?2 u7 G) t# s& p+ w3 ~ns_marquee.document.write(marqueecontent)
. D& ~; R5 S0 Pns_marquee.document.close()
8 p1 }9 i3 C& _- y2 e; tactualwidth=ns_marquee.document.width+ g0 W' D+ X' r% L }1 N4 R0 I
}( a( l1 w$ u$ Y1 O6 c
lefttime=setInterval("scrollmarquee()",20)
9 p3 Y% @8 T" K: _0 I1 L}, e1 i. O/ D# p# i! Q
window.onload=populate
' v3 I* p+ N2 L3 \ C1 v7 C' J$ o+ G6 U
function scrollmarquee(){
0 g/ F4 S4 }# R9 ~7 I0 w. d3 ^" {if (iedom){& ^4 I+ R4 X' D% v' z+ r
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
$ D% q7 ]" J( Y) Ncross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
u# c4 o( D. E( ^$ M# x0 Qelse
' {3 j7 x5 f+ r. p: X, C- vcross_marquee.style.left=marqueewidth+8( v+ t; w. h- d; X* _2 e
/ ^$ R. ^+ y3 A; g4 p8 X}
! T/ F$ |3 \1 I, y8 n* C; A, xelse if (document.layers){
5 g0 ?4 n; q7 U1 T) K0 h8 p7 z# H: z+ Aif (ns_marquee.left>(actualwidth*(-1)+8)); r3 ` N- `& n& @% K1 E S$ b
ns_marquee.left-=copyspeed
1 ^; _6 L% x/ ~" Q8 m) eelse w5 S. n, v D" M5 V' B
ns_marquee.left=marqueewidth+8% E/ A2 @( f1 L# `, Z( o3 ^; s( U$ e
}
9 G; p! D, [6 E% c% O9 N}
" N5 z( f. K8 R, \/ \
4 @0 C2 z s* z- Aif (iedom||document.layers){
7 m( }2 s9 J6 B( ?% rwith (document){. U# y% b; c% m( K- a
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
. a0 c- Y" [0 m1 o. p: Oif (iedom){
0 }4 k4 \" p" l* fwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
% {( E' E: m) |) mwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')$ d9 d# F5 I: M# |8 u
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')2 Q" X8 [2 Q7 ?5 Q
write('</div>'), |( J8 u7 @3 g/ d+ D
}
& V3 e3 D/ q% p* ~$ d& oelse if (document.layers){
# t) n! H' f% L0 Lwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
) M! q t' r3 k5 F+ s+ Pwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')/ ~7 z, j6 l, x. s5 e
write('</ilayer>')
: m( d# t# h+ V}4 F9 B3 f/ b* C0 o; Z
document.write('</td></table>')
# n: I! L- z' ], b}
, b6 v8 @( B- f! z' d}% ?0 u' U) u0 b) `! d$ f
</script> |
|