Board logo

标题: 网页之跑马灯文字特效 [打印本页]

作者: zw2004    时间: 2008-1-21 20:53     标题: 网页之跑马灯文字特效

//修改宽度
- W8 m. G, m+ Mvar marqueewidth=3009 B% k$ I  s" l  z
//高度2 ~- s8 [% {9 \7 b- p* j
var marqueeheight=250 n8 L: r6 j2 k1 F; l3 A& i
//速度(1-10)5 ^$ H+ b& s4 s
var marqueespeed=3
9 F( P8 W% ?; x$ \3 p6 ?//背景颜色2 K1 E3 ]4 J, o+ d6 o
var marqueebgcolor="#FFFFFF"
" |6 v) K, r6 _# T9 o" ^//是否能暂停 (0=no. 1=yes)?
9 y- x  }" L6 M7 w% J6 avar pauseit=13 V9 }1 _. c! t' x* u, W

- g: H! ^4 ]8 u! s& k, m//修改显示内容% X8 `5 E: \+ C. u- A" D
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
' C( E0 y6 r$ ?. z6 M. C
2 e! s% o6 c) F/ m8 G, j1 Z
1 n) w& f; E' n( _////下面不需改变////////////
6 d+ v* p/ z# X5 I7 k/ g6 K
1 h3 S/ v; k) v% `4 e/ ~  rvar copyspeed=marqueespeed( j0 Y( u- d; e1 g4 F
var pausespeed=(pauseit==0)? copyspeed: 01 q# C. S* I0 Y+ F
var iedom=document.all||document.getElementById
6 _) Q; G9 C; s+ a, rif (iedom)% H; d6 P' @) t. X* l& L
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
/ U7 G/ B& w4 B( d  Avar actualwidth=''
4 b" `( l/ a- L: L& avar cross_marquee, ns_marquee
) J7 M% I0 g" _& k
8 C' p$ M3 _2 s  \function populate(){- h7 e8 W0 E+ M; i9 \; U
if (iedom){
, K5 O4 a4 P- _cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee1 D3 J; g, ^9 y" a% N
cross_marquee.style.left=marqueewidth+89 e' J& P6 K1 E( L/ [
cross_marquee.innerHTML=marqueecontent
1 i- ^. i5 z* [8 p1 h. [! b5 `% gactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth5 ?, p4 @! R" l( q
}
' Q0 c  i; e# l& f. Z# uelse if (document.layers){8 u% u1 r4 S1 x, U2 V
ns_marquee=document.ns_marquee.document.ns_marquee21 m& |$ M* Q. \; d# u
ns_marquee.left=marqueewidth+8" N- B- @! l# f  |, {. t
ns_marquee.document.write(marqueecontent)
4 G  Y# O5 Z) v4 k) f9 j0 I: `% Lns_marquee.document.close()* N% h' K' Q) A, I6 V
actualwidth=ns_marquee.document.width- e; U8 k6 d6 B7 Y  A
}/ X6 a0 r0 g* E4 j  ^7 N7 a' r& o
lefttime=setInterval("scrollmarquee()",20)
3 Y; `* t, r% m! p}: ^% i" a( j( Q" \4 O
window.onload=populate! h% |4 q" J) \1 @

& j1 F6 Q. o- V  p. c6 z8 ]function scrollmarquee(){
6 j2 H6 j+ d8 [* P' u% K& `% Dif (iedom){
% J5 s4 ^5 o3 U' }5 l3 Hif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
) t' \6 r& y. E4 X9 Scross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed1 J; n, k& b# ^: M4 b
else
6 W. }) l4 }+ vcross_marquee.style.left=marqueewidth+8
% D; o) }7 [4 U& {: m% y* @* s5 {' A, w; i" r0 u& F; u
}
; ~4 v; P3 Q2 j, \7 X" x6 {7 u5 L+ Qelse if (document.layers){) _6 M/ h+ E; t& y) e" a. F
if (ns_marquee.left>(actualwidth*(-1)+8))0 g0 ~# V1 N. h/ T2 m
ns_marquee.left-=copyspeed
: e/ C$ b0 D6 }5 v% K+ v! X( Z4 ^else
4 h: s7 \/ E3 h3 I& E. `! `0 gns_marquee.left=marqueewidth+88 G  ~* j1 E( V; z3 X
}6 m/ y- t2 Z: a; [! d% Z! H% V
}1 ~  m  K8 \, m% \% ^

5 I) O# ?# A4 A  h" `; l2 `' @4 d+ K7 zif (iedom||document.layers){
) x: L4 _2 y! L1 ~" Kwith (document){5 h( ]  N1 k6 M; V
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
" L" m2 K+ w' w! p& F3 C* q' F) S6 [1 Bif (iedom){( E. h8 E, i3 Q% l8 t" U
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')2 }2 w" r/ d% g; b+ T/ N
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')8 z7 K6 D& M1 t+ e% X4 q
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')1 k" T0 d' s  \- z5 a' g1 n- G- M
write('</div>')9 }+ i3 c& G7 N% \3 n6 x4 P( B% ?! _8 M
}
% x) C( |2 z: p9 q. Ielse if (document.layers){
0 z$ w6 ^/ x. {& Dwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
  }) {$ x8 q, vwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
* w7 S, J' ~) m# [3 k8 _write('</ilayer>')
; c' B, S! F5 }}
7 k* k1 [5 d" T5 p9 a3 a- H& m  Ndocument.write('</td></table>')
3 C- G1 d8 a: k  Q0 p}
2 |0 t2 D* }5 B! h4 _}8 x7 @& G. p) \0 Z- M3 \) }
</script>




欢迎光临 捌玖网络工作室 (http://89w.org/) Powered by Discuz! 7.2