返回列表 发帖

网页之跑马灯文字特效

//修改宽度0 @, \( H4 |' o. f7 z
var marqueewidth=300  L$ a) V4 `5 y/ C6 k% F9 {: Y# d
//高度
3 J6 v9 ]" ^  d/ r8 ovar marqueeheight=25; y* x6 U0 i+ `: I9 }
//速度(1-10)8 p, k6 A1 T, Q7 i, E7 B# G
var marqueespeed=3) V1 V* X) s1 X$ g2 w  ^: x
//背景颜色
$ b7 i4 j0 r& i8 t% n/ W8 mvar marqueebgcolor="#FFFFFF"
$ g6 c+ p( u% {6 m//是否能暂停 (0=no. 1=yes)?) G  [( K7 {  _# s" q; V
var pauseit=1
9 u: V" o1 d2 K! ~- x6 k
. A$ x/ h5 ?4 K, M8 b5 }) Y& [//修改显示内容
! E2 R1 M/ d: y, s$ K: c# O5 N5 Tvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'0 X. e7 ^% |9 K7 {4 m4 `6 x

0 F. d8 m% s; b! v* N. [9 S* w) J7 N1 L5 d3 v  M
////下面不需改变////////////( w2 n; S9 W( R

5 p( ~- j" W* b1 E* Ivar copyspeed=marqueespeed9 B4 X/ u( \, n# X* t9 n  o- V0 a
var pausespeed=(pauseit==0)? copyspeed: 0
. v/ b  o; j* E# S/ s! z, Avar iedom=document.all||document.getElementById
& ?; w, n" u6 r) ^! d5 Hif (iedom)* j! q6 ~, V8 X
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')! s" \) x+ M: I0 ?( N# n
var actualwidth=''0 A3 |( t! c- Y  m3 P/ X# H1 z
var cross_marquee, ns_marquee$ `8 u( o% M" y% G0 p

: D; A6 V. b% r) Y8 q, x) bfunction populate(){
* e( R% r* Y" D2 Vif (iedom){
! }. b/ x7 s: C: v7 g: across_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
3 ~  T  k4 |  m- \) K/ S- @cross_marquee.style.left=marqueewidth+8
7 r6 _+ [" `- u8 A) Tcross_marquee.innerHTML=marqueecontent
, X& M# a; I$ c9 N0 iactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
7 z% v/ ?9 B2 ]9 k7 r. c9 M}
. m, Q/ K1 ]3 F& y  J  _  H. ielse if (document.layers){
% L$ f) K/ H: _' O# m6 f* i: t! Gns_marquee=document.ns_marquee.document.ns_marquee2& k; C6 v% w$ h& O* ^8 e
ns_marquee.left=marqueewidth+8. Y4 A6 W1 r+ v: v, P% ~, W- J
ns_marquee.document.write(marqueecontent)8 V& s) l5 Q# ~4 i3 Z' S+ R
ns_marquee.document.close()  b# ]# \* Q$ O) q5 P# `* K
actualwidth=ns_marquee.document.width
, n& l) M0 j% t8 M4 U3 W$ f: ?( E! v}* x& C2 M$ o; w. V4 z0 P1 K
lefttime=setInterval("scrollmarquee()",20); H% \; u* w3 e
}* u/ m. n" n/ I' Y
window.onload=populate; E/ p# W# y) f9 u
* q8 m4 v* |# L4 K* z& u0 U3 o' A& W
function scrollmarquee(){
! c1 B/ m  i! ~. o" P1 b& zif (iedom){
7 g5 f4 S5 I# i/ p. `1 ?9 \if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
& _+ r: T; \5 u+ ^: ~; mcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
6 _9 |% p9 I' V& \' \; Pelse
2 [6 b- e) o+ G- S$ l9 `8 N2 n8 z; w/ Ncross_marquee.style.left=marqueewidth+80 g5 [3 m2 O5 H+ D* S; }
$ ?0 R2 q$ @$ Q+ ^$ P
}
# a0 Q+ a: ~( {1 k8 }/ ~% L. Aelse if (document.layers){- Q# X8 B; a8 K" }: \
if (ns_marquee.left>(actualwidth*(-1)+8))- V2 w/ [& l; S2 `
ns_marquee.left-=copyspeed) t( P% L  A. Z: x% W4 _9 l
else, G# r3 y; B( E. n% w; m) p. L
ns_marquee.left=marqueewidth+83 Q2 x- j% r: u1 a1 t3 x
}
  n7 k$ X! t6 R( k( r}1 s% v! Q! T& O8 m3 N

, U! E  p- U8 wif (iedom||document.layers){% ~- }  [, K; M+ N! a4 c1 `/ |0 |
with (document){
, T& `. h4 y  Q# ~$ L8 V' tdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
- ]5 V" L1 e  Gif (iedom){8 G* W8 x/ ?, L! h2 \9 J5 e  E
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')& U$ O3 Q# M7 [& r$ x7 V
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
6 [$ P9 R6 K* Z/ Q4 v% Ywrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
& N9 B2 c8 C( Z+ Pwrite('</div>')4 J$ H, z) J6 k  {
}2 X& Q: C1 i. O6 Y- `! G9 v) D+ U7 B. d
else if (document.layers){
; f7 B- D$ `4 K9 s. D8 R& S& r. Uwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
! ~. E! m) M" e0 Zwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
  I( W! q: j  C  a7 {+ m4 ~$ S/ k$ w. Lwrite('</ilayer>')
( m% T& M9 u* E5 q, R0 f}
4 L4 ]4 g* X& b) F, Sdocument.write('</td></table>')0 c7 @& E7 y8 S
}
3 g8 S0 w7 Z' u+ O8 J5 Z! x}2 L, C2 E8 ?( t% S1 h; o
</script>

返回列表
【捌玖网络】已经运行: