Board logo

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

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

//修改宽度4 r0 D' x* l. _6 _0 p9 A' N% n  ?' @
var marqueewidth=3005 T  E0 u8 e9 f% ]9 t1 m
//高度: L9 t( M  I- m4 p' ?( _
var marqueeheight=25
0 I- d! {3 N& M7 ^//速度(1-10)
7 p, l* {8 V' z9 b8 ovar marqueespeed=36 J; {7 P, [6 {% Z9 `
//背景颜色1 z, J2 a+ [' }& R
var marqueebgcolor="#FFFFFF"3 z/ H5 z1 |$ |4 m
//是否能暂停 (0=no. 1=yes)?$ T( |1 k+ V, F0 k: |6 q- D/ |
var pauseit=16 c9 d  L+ F- o, w
2 R) A; m4 P/ I) Z; ~9 u& ~, P
//修改显示内容
9 k" ]( D( E. F6 Fvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'- |2 V$ r/ X1 i8 k* z
; y4 p+ V5 C! H8 X3 ^
, q  w* i9 ~. U* Z) A/ Z
////下面不需改变////////////+ a  V& P. ^6 B: E  O

* T' b3 S- N+ S2 N3 r" evar copyspeed=marqueespeed) I$ ^% B) j4 h3 Y# \( m. e
var pausespeed=(pauseit==0)? copyspeed: 0
- J7 I# X* G% l* X9 E- r1 Qvar iedom=document.all||document.getElementById
  n2 e3 Y3 [) ?9 H, i  m6 ^if (iedom)/ _( h) R6 e2 B) s" K9 {6 F
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')$ S2 b/ y9 \5 v7 i% c
var actualwidth=''
9 y' b# u  f# G0 O. Xvar cross_marquee, ns_marquee
% l7 Z( [; e5 ^: T4 {/ @3 Y) _/ r0 |9 k5 e  h
function populate(){4 v9 H; I' D. q& B+ @/ W
if (iedom){
0 Y9 l; p- W# l. Ocross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee4 I& N8 \6 z% N' [/ V3 [! _, Q
cross_marquee.style.left=marqueewidth+8
  N* ]) E8 y2 y" q: l( a: Qcross_marquee.innerHTML=marqueecontent
9 y9 L5 a( Z% |& q, n$ |( }actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth/ j* X$ O* `4 Q) p( K, |# p$ B9 [
}- }# N: K: b6 ]6 ]% L
else if (document.layers){
5 M1 u- e! m: L+ ?( W1 H, o; @ns_marquee=document.ns_marquee.document.ns_marquee2  {  U2 N, P" |# @8 }6 t
ns_marquee.left=marqueewidth+8
+ O2 H9 D! y1 E. G. Y/ mns_marquee.document.write(marqueecontent)
" \0 f: a# R* y1 ~" l4 |- {ns_marquee.document.close()' C% z. K0 X+ i% y/ ]8 N1 @+ X
actualwidth=ns_marquee.document.width
+ y# ~2 Z. ^7 O" \. m) g. V}
, |; R5 n+ B; z, ~lefttime=setInterval("scrollmarquee()",20)$ n; S5 z( W8 {- [
}
3 s/ A9 ~4 ]( N/ H7 [4 Iwindow.onload=populate
3 N+ Q# D3 U" O5 y# t
9 t' h4 w2 }# @# Jfunction scrollmarquee(){+ u) Z4 u6 C4 H: _/ p: c6 }' ~* ]
if (iedom){
/ t8 p: M  O! [# p& C" q: `" bif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)). Q1 H( b) F% b& n& E* E
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed  V! \6 S9 j7 Q6 ^, ~
else" c7 @1 O& [  u2 n0 W8 }2 @
cross_marquee.style.left=marqueewidth+8
; d1 A7 H; Y! V1 }& V; M
, x2 C* O' c: z( H6 @}6 E1 j0 Y. v* Y; J4 i* e6 y
else if (document.layers){
* ~' }' X, Q3 n( tif (ns_marquee.left>(actualwidth*(-1)+8))
. C* g9 l. T. Yns_marquee.left-=copyspeed* f. Q& q6 g- {; O0 J( h. m
else
$ I' f, `, b& j: w8 Z1 g- Bns_marquee.left=marqueewidth+8
9 F9 |( r# [2 `. i) g2 h5 o. j) \}/ h' x4 R  j4 m2 p
}
9 z4 c" c8 T. w) t6 U9 g! y/ G8 @% j7 v+ I
if (iedom||document.layers){
+ p- ?, I$ S8 ^3 q& E7 ~with (document){
7 Z2 ~- [: K" ^6 odocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')7 q3 B/ P# n( ?4 s
if (iedom){
1 ^9 ?' ]; k/ ^, P  ywrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
# m: y' \9 u! y$ u$ bwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
8 \, J8 O; ^0 E9 x3 M9 dwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
) g, t" j& E9 _: U' rwrite('</div>')
# ]; n7 p, u" U6 ]# Q& u% E* Q5 H}
: v, ]$ O2 ]1 ?% Q/ belse if (document.layers){
9 g& i6 |* h$ l: H3 L, Owrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')7 W- m, u! T3 `0 S4 Q: n- M. d
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')+ k/ c, t: H" p3 Q9 z. a
write('</ilayer>'); \# r* k' k! |% S/ B1 P2 C
}
3 R: Y6 o6 P( f: j! M) n0 \) Odocument.write('</td></table>')/ O6 \4 T" F! Z: N# K
}
+ ?  g# o2 j+ d) b0 [, B1 ?}3 N: A5 t6 P) V/ q# t+ j; W
</script>




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