获得本站免费赞助空间请点这里
返回列表 发帖

网页之跑马灯文字特效

//修改宽度
3 p' S) s% h6 L4 n: w6 hvar marqueewidth=3001 c. w: F1 y/ }2 O0 X: V% g
//高度
$ j' @% C: O; t! H$ zvar marqueeheight=25
: }5 r: p' v4 Y9 C$ c- ~" K//速度(1-10)
; _6 v( v+ Y4 b  w8 `& x4 U8 J$ Hvar marqueespeed=33 Z$ x9 O8 o' }, T. K) F: ~1 `
//背景颜色( }* y) b7 u$ d0 R
var marqueebgcolor="#FFFFFF"
" `* _0 u0 h# C0 Z) T' F- W//是否能暂停 (0=no. 1=yes)?; Z; Y7 o% B, g) K- f1 g
var pauseit=13 C$ N% \- G2 t% U

  A$ {! d& y) y7 Q$ g//修改显示内容
" l/ \" u3 a/ V+ b/ W8 Vvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
9 x2 K4 U4 o* V/ e
3 ?: G2 G8 Y$ q0 E' u4 q# u# Y2 [2 w' G: g* _  [+ k
////下面不需改变////////////1 f$ ]( O- M3 X# h) D6 s

6 [. P7 P' P4 i8 @4 Pvar copyspeed=marqueespeed# v( t( L# B& {: Y" M7 W8 a0 ^. w
var pausespeed=(pauseit==0)? copyspeed: 0+ R( E& F& K/ t
var iedom=document.all||document.getElementById, C5 t7 J+ m3 y; i
if (iedom)9 D2 H8 U# D" P3 e0 {- |
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')* H. M3 I3 o- N4 r+ q8 t7 l2 a
var actualwidth=''" _! n+ z/ v6 y
var cross_marquee, ns_marquee
5 Z/ b1 _/ d0 h( C& {- B) g8 C* M+ K, T$ [% V4 P. c% `2 R
function populate(){
0 M* D2 s+ c, u9 U8 Z9 Z, gif (iedom){8 e4 G; i' k2 ?$ Q+ R
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee* {7 K$ k4 c( g7 C- m! _) x
cross_marquee.style.left=marqueewidth+86 J! q  V' V" R" Q# \
cross_marquee.innerHTML=marqueecontent4 g: W: c; ]3 b8 ?+ |, D! z" Z
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
% r4 @  x8 s" f* n6 n1 G" g}. Z- s0 }4 m; k% G) [3 g
else if (document.layers){
1 w, p& M" B$ V% s' xns_marquee=document.ns_marquee.document.ns_marquee2& J2 @4 K9 w$ P4 e7 d
ns_marquee.left=marqueewidth+8) K5 u+ W8 v* |- H3 E  p- U
ns_marquee.document.write(marqueecontent)! _& ?# {7 I# c$ A( q1 x4 }
ns_marquee.document.close()
/ r; c- W# B% _( f' h1 y( U+ Wactualwidth=ns_marquee.document.width
5 t3 D& w* `% |+ {: i; b' x* H- u}
8 o7 S7 `1 f- E- M, U7 k$ alefttime=setInterval("scrollmarquee()",20)
( T* u3 i/ Q) P" y3 f& W}6 L* S0 R: z1 C, I
window.onload=populate; T; \6 O% J) k) H4 |' I# G+ G2 `2 ]% {

3 e. B+ l5 Y2 w5 i: _7 ]function scrollmarquee(){" {; N' p5 N; l$ O# ]2 ]
if (iedom){
2 E( B7 X1 [4 z5 [, o4 w+ Z1 nif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
) x0 r5 j* a: j. ?5 i2 Q) across_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
4 w' w. d+ c: k) D. o/ belse
; ]0 `% A+ n0 N% ?0 J1 P* ^' B  Kcross_marquee.style.left=marqueewidth+8
+ N. F) _6 z$ o" t
# s0 ~9 g. U/ Q4 C}# q7 f/ n7 e& ?
else if (document.layers){
* p, g* D: Q3 ?1 v0 Cif (ns_marquee.left>(actualwidth*(-1)+8))5 \" F* o4 J5 l
ns_marquee.left-=copyspeed6 y  p: M9 ^% v2 j
else3 r9 n, M  |+ N, ?( D2 Y7 f4 Y" m
ns_marquee.left=marqueewidth+8$ d6 L3 f9 N5 ]( ?% L4 ?
}8 {' d/ c) u9 ^: T0 L/ l' C$ @% K
}1 B5 u. G- {# G  ~4 b

! V* w1 j3 a5 fif (iedom||document.layers){
" W  }5 H% T- L& m- f8 z: qwith (document){
% |: w* p! Q( A* |document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')  X& d( S- ]' c5 B; ?+ s
if (iedom){
# G! N! P" i& Awrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
9 A) W5 ^* _  p% Uwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')5 d3 ]% b# _; @' g
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')  t! [+ @, A$ N& i
write('</div>')6 z' W* J& F0 M4 q+ P2 x( O" G, a
}
! c& [3 f* _* J6 D8 t' Q5 Telse if (document.layers){
; k4 Y; u& L/ r- [$ M" S, zwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')# P- q! R( u. L
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')4 f& p5 w+ C+ I, x8 V# Y% ]( d
write('</ilayer>')
  J! \# u* N+ k" v9 }}* J3 Y6 g$ A# w) r
document.write('</td></table>')  E# L5 `7 k& v! }6 h" g3 z1 q9 I
}
6 q7 U8 E$ k. B}
0 O% T7 W8 y$ w& V</script>

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