返回列表 发帖

网页之跑马灯文字特效

//修改宽度
" _6 w1 @7 m2 S# Z0 y  Qvar marqueewidth=300
6 P5 Z" l# }5 R! z) C' A//高度& Z1 [3 ]$ Y/ s0 v8 @0 {- x
var marqueeheight=25
2 C2 \% h9 [$ b! @" O% g9 ]//速度(1-10). p* d; K/ p  \) |9 q5 P9 K/ K8 A9 R
var marqueespeed=3
: u5 t7 r3 L" y! S/ t$ b//背景颜色
0 Q" v9 t6 p: v" m- k. d* Jvar marqueebgcolor="#FFFFFF"
' A3 O! p+ I" S9 j//是否能暂停 (0=no. 1=yes)?
. w( w8 p" [' R$ [- Wvar pauseit=1
( O  q/ ~. \8 v% u4 e! T4 k) T2 A) \
//修改显示内容3 y! ?( s! a5 U: C9 k' `
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'/ {  K. h8 R' c0 T3 N! C- y* @
+ P$ q# c" ~5 U' A2 Y8 D. O$ H

; K7 l! ~+ k) F$ x////下面不需改变////////////
! r" V' l( ~9 ?
( z/ ^9 N7 m2 y; N% Y" ovar copyspeed=marqueespeed
8 n4 A/ m% @6 k& J* A4 t) j; `var pausespeed=(pauseit==0)? copyspeed: 0( i8 S6 U) T2 v* {
var iedom=document.all||document.getElementById$ `/ S+ x. {) |
if (iedom)8 d" f) P  p3 \) ~9 c! z
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
. m! L' J2 R5 n0 O( Avar actualwidth=''* e  m' N$ c; W1 ~/ a' n
var cross_marquee, ns_marquee& S6 h& M8 F) r+ l. B5 C3 T
) _; g7 n' \: e2 l3 C! u% k1 `/ j
function populate(){; @4 N) t4 A) U8 C# x+ J7 @8 K
if (iedom){
( ^1 |8 l/ O3 s' X) l0 qcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
5 z# o0 L% i1 Y9 J% v9 @cross_marquee.style.left=marqueewidth+8& d) I/ g* ]* T  x) h
cross_marquee.innerHTML=marqueecontent
+ S% J  G3 @1 ?5 Q+ n* q  p$ Nactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
7 s& e: e9 C) i}$ y* q" Y! @% n% y, y5 T* b8 i
else if (document.layers){5 a2 Y! c. p2 P$ r3 h2 [
ns_marquee=document.ns_marquee.document.ns_marquee2
4 E6 p* E1 [1 a) Ins_marquee.left=marqueewidth+8
* p, k) B1 `- V0 N/ K% ~) l$ a0 kns_marquee.document.write(marqueecontent)
! x' ^2 h8 F: Q6 h8 ?ns_marquee.document.close()# s6 @3 H) I. |  j: o. |
actualwidth=ns_marquee.document.width
& i$ j0 Z+ c; `) x6 g}
, |$ P1 b" @" Y. Q$ e- j! z! Qlefttime=setInterval("scrollmarquee()",20)
- u3 P# Z# V, j# J0 b% V4 s}9 o8 f4 ^9 O9 k& Z
window.onload=populate
6 g+ D8 ^, T& \& \% O( w" d/ _! h
+ [. B, S5 t; L/ S; Efunction scrollmarquee(){( f( D* J" r9 S
if (iedom){
" n) }+ ?3 m! q1 e+ A$ E  R8 D7 |if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))& ]2 E( f7 c6 a; X
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed  r9 d4 j. V- I! Q+ f+ H
else
! U$ o, ^; }) Y# bcross_marquee.style.left=marqueewidth+8
% F; A2 I( Z& d$ \2 _. |, H* ^3 i% B1 `, p1 ?" V
}+ `: @: E/ W( y9 }) J" O
else if (document.layers){: G: S5 M4 \0 @' q1 z5 j
if (ns_marquee.left>(actualwidth*(-1)+8))+ O, I' D. z+ C& y7 [( U
ns_marquee.left-=copyspeed
/ e) g8 K$ M! d$ w9 `; T' x. jelse
7 y. `% t5 l3 B. Bns_marquee.left=marqueewidth+8
$ |8 _! G; c8 y. }: Y}
' Z# M2 t) G0 u& `' G2 r}
  g9 t( e- T9 t5 E( y- q9 |- q3 c$ L2 k6 U: x( E4 s0 l& l
if (iedom||document.layers){- Y9 T3 W8 r  j
with (document){) {7 i  T; Q" w7 O- l
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
4 m8 j# p- O! F9 r% S. Y# Jif (iedom){
7 M& `& L7 t" ~2 |  u6 mwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
. J( n$ t8 X- T' awrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
, N! A  I+ M! V9 Xwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
- a& j$ w6 c* a7 Vwrite('</div>')) N( S7 J8 t: S$ g! S% @8 u. D' V
}1 b. V5 m4 [# _7 ~2 l* I+ p9 ~6 B
else if (document.layers){
. R( o2 h& U9 X4 n; e% Jwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')+ z7 f% r' Q  W  g" C1 t! ~- v" `
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
. Y8 M1 p& x  H. Wwrite('</ilayer>')
9 l3 y+ L' H( Q}
6 T* U# V- w! N- S- @& @7 xdocument.write('</td></table>')
6 h2 @" _! g/ H0 q& P/ ]}6 b6 m, K% X1 M5 O. {
}1 _' R$ U& m3 g% u
</script>

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