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

|
网页之跑马灯文字特效
//修改宽度
- j- J2 g) l' \) x4 j- y" B0 vvar marqueewidth=300
5 J9 }3 \: N( ~5 [5 { _( v/ X+ y//高度+ b2 `5 o1 O a0 x" |* l7 O5 N
var marqueeheight=25
9 n1 y, ^7 {5 v//速度(1-10)
; H' V) k5 Q8 O0 w$ ~7 ?# yvar marqueespeed=3+ N8 ^: T) |: `
//背景颜色' |8 z3 F( g- A/ \/ u7 L: `
var marqueebgcolor="#FFFFFF"! ?! w5 l! j/ d- }9 r" q( l. [8 j7 m
//是否能暂停 (0=no. 1=yes)?
D4 w" F% O( i1 u' Nvar pauseit=1
6 F! s% e7 O' l& d, }7 N7 t: J% M4 a' G2 {( l/ s
//修改显示内容
/ s% Z+ T3 W" r( o8 Cvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
; f/ b4 O. b8 n. Y# P' S k6 K& J6 s/ V- F `
3 y) u( o3 h, d x////下面不需改变////////////9 M0 y; y1 K8 x" v5 ^3 F& W
, b) G" E+ g4 f' C/ U: i$ T2 c
var copyspeed=marqueespeed+ t1 Z A; e! Y. G! x3 B3 F
var pausespeed=(pauseit==0)? copyspeed: 0$ c8 b' z, ^/ Q$ j+ O
var iedom=document.all||document.getElementById( H( f, ^! o' q
if (iedom)- d/ ~. D$ L' w9 k4 l& |% v! y
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
" F% H' ?& j3 h% U# _var actualwidth=''8 M3 y$ B9 V: c# W" @
var cross_marquee, ns_marquee
0 w: r* }) I% j! s. k% X: t$ X9 k$ T/ v2 ]
function populate(){
( x+ j3 h* _) h' q bif (iedom){
+ G! M+ m. s1 p1 I( y+ qcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
: V4 {; U# |' w( Ocross_marquee.style.left=marqueewidth+8: h- a$ c( T- n1 K% z
cross_marquee.innerHTML=marqueecontent$ b# k8 M; r3 l+ `0 n
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
( {! N2 o; _# B* p" g}4 d6 h- I: ~$ q% a
else if (document.layers){
. F8 W3 M0 S4 o0 ?' k: n! B5 Xns_marquee=document.ns_marquee.document.ns_marquee2; a% {3 M& s6 q2 a, x, P
ns_marquee.left=marqueewidth+8
2 I% S+ X6 O2 |, E4 i# Cns_marquee.document.write(marqueecontent)' D# j$ {6 z6 p. ~8 g9 ]7 y
ns_marquee.document.close(); W9 D! D- G/ E: e0 U
actualwidth=ns_marquee.document.width( s3 s0 }% Q8 g; W* S* v9 [% K/ H
}
5 U2 q+ \# p0 {3 Ilefttime=setInterval("scrollmarquee()",20)
+ |: Y% y; f y" C6 p9 j}; H" F4 s! F. u
window.onload=populate
$ R* u e! {, r' v) ^9 x
8 V# L8 t+ r2 P- M6 [function scrollmarquee(){4 D& Z$ W u+ w/ ?8 c8 C
if (iedom){
1 ~2 T: I1 Z: W1 tif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
: [. c" ]" Y0 _cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
; H9 I* k) [" B3 o- ^else
( _/ K3 w" d# ]0 c# f9 k4 V! n" gcross_marquee.style.left=marqueewidth+8; [( ]7 x; x6 d) J* s' A
1 U" Q3 ]$ G8 v+ m' A1 I}
$ q' M! h# ~, Helse if (document.layers){
# i @6 x, }( z1 [8 r; hif (ns_marquee.left>(actualwidth*(-1)+8))( x6 U- {# q( [" T
ns_marquee.left-=copyspeed
3 X" T* u& s8 m! Relse9 T% c. A7 J; Z3 l
ns_marquee.left=marqueewidth+88 D5 y' K5 v: `( s
}
% `: F! w- \& z2 W! g9 L' U}
( k1 `8 _8 C% V" P4 U; F' D2 J4 O, y1 `% b4 e( \7 F% _1 Z
if (iedom||document.layers){- I; p" G# |7 J, v
with (document){* `8 c i/ b8 w$ ^/ F3 I8 V, y
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
+ V3 B0 o% i3 ~/ T$ z& fif (iedom){3 ^" e! P5 I n- N. I4 P) U+ U0 h% e
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')) {4 Y0 ?4 U0 }
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')9 m9 Y3 V! y# g v; Y$ {4 \
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
0 a. _5 c6 p* s5 L0 K8 Xwrite('</div>')
" j' V. }& r4 C1 _}
- O# `+ x0 G% Q7 G3 d; _ j v! l4 {3 lelse if (document.layers){/ C' e6 v: `+ C
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
. V+ U/ p8 M/ v% g4 q& k( pwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')' U; D1 k, S* [# l+ D& g2 T
write('</ilayer>')2 s' Z! `1 w1 t
}
1 Z: F4 H1 h ?3 ?+ U! k( s0 Sdocument.write('</td></table>')
) X! o- K" P5 [! A}
& N3 s5 x9 N2 J8 q7 J; R! J}& |! u3 X1 L O1 _
</script> |
|