Board logo

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

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

//修改宽度
* h* s0 Y6 w4 F3 V. g# ^var marqueewidth=300& X# _: b" w* q
//高度. S+ W3 q/ g' r1 Q6 a; o
var marqueeheight=25# P/ e9 N( g6 n$ t7 @: k4 m$ q
//速度(1-10)+ ~/ @; q  L! t" {' q2 `# b
var marqueespeed=3
6 c9 d2 g0 g) E' y1 Z% C//背景颜色
; r9 S/ P; S2 \4 {2 V+ r: y* M: {var marqueebgcolor="#FFFFFF"
( W& x  t% g% K1 _( c//是否能暂停 (0=no. 1=yes)?9 g' r* c2 y; q7 m6 _
var pauseit=13 ^- C- i: H% l; V1 |
5 `0 T6 z2 n1 N9 U# X9 J
//修改显示内容
( S& D+ M" M0 k. d! g/ F2 n( Vvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'7 G) x6 b0 S7 i1 C! C4 }
, P  C: p4 y8 j

0 c  v1 e3 @) H5 o1 Y  }- U4 |////下面不需改变////////////. j' ~! |; Y$ _3 m
2 T( a1 s" O9 q8 L! k5 E! E+ s
var copyspeed=marqueespeed
  F! h$ z* }; x  kvar pausespeed=(pauseit==0)? copyspeed: 0
6 ~, `; w# E( nvar iedom=document.all||document.getElementById$ y- J4 c& R6 y: b" y) e
if (iedom)
; F5 [9 B! G- b& P1 rdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'): P! a7 `' F/ G+ ?+ ]8 R0 o
var actualwidth=''
6 a; J  j2 b6 v) v4 F% J$ jvar cross_marquee, ns_marquee
# }$ R& D( A4 i/ }6 H) S8 O3 n5 ]- x2 F) ]# q
function populate(){. S7 \* t& j3 G% l3 ]  ]6 C# |9 W
if (iedom){7 I, }, I6 w. O/ ?7 M/ \4 ]2 {
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee3 U; a1 @, k( C9 e
cross_marquee.style.left=marqueewidth+81 F) {% ?' U- N5 t
cross_marquee.innerHTML=marqueecontent
- ]! [+ ~$ I7 Q( _. @actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth0 _  v( p) H% ~5 n3 Y% L
}
  S% e9 m3 r4 eelse if (document.layers){
' g& v4 ^! \3 F. n& u: e& ~ns_marquee=document.ns_marquee.document.ns_marquee2: K' q. Y+ q& n0 r! m& w$ g
ns_marquee.left=marqueewidth+8
# @  q1 J8 \- s% b2 d( tns_marquee.document.write(marqueecontent), c9 H/ m8 M* K4 W0 @* u* {# y* Z
ns_marquee.document.close()
% `6 \# E0 h: B2 c9 ?actualwidth=ns_marquee.document.width5 w/ w) e2 k- v% U$ r
}& n: G& X* E4 ^* ^# R
lefttime=setInterval("scrollmarquee()",20): D# e# f9 m. v. @
}" L  K5 H  x$ Y1 {( ~7 B
window.onload=populate/ M  Y1 V/ d; d- `

6 ]0 J7 P. J: `" g2 I0 T7 ?function scrollmarquee(){+ G' V- E6 j7 b
if (iedom){9 h( s6 d7 _+ v, a
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))/ ]/ S$ [! B" b$ x# |7 N
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed5 o" a  H# [6 w: B7 D
else
# `7 d+ B% g5 m. s) r; j+ ccross_marquee.style.left=marqueewidth+8
4 I: z/ V9 J% P4 N! v' l" h: q8 }- X+ B4 q
}# y/ \" I" @4 @7 e) N
else if (document.layers){
4 m; T# z3 \( F) |: T7 Dif (ns_marquee.left>(actualwidth*(-1)+8))% c" X8 \) f+ X5 J. \* V$ }$ N
ns_marquee.left-=copyspeed5 W% z$ i7 u5 m, M+ J5 ~0 Y
else
5 J( o: V& r" e+ Tns_marquee.left=marqueewidth+8
  O; d9 l% g1 `, m}& v+ S& ~- g# ~* @- d
}
, u0 y7 D/ M1 ?* z5 P. s7 V$ K. `
4 y( _7 Q% f' o4 Z$ t3 b: ?, _if (iedom||document.layers){
' U: _1 R* s+ i5 M* Z/ Awith (document){
( g* l5 k1 D2 }, Xdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
/ j% |* h: H6 B. W7 E& @if (iedom){. D, h# X; C! T0 N" ]0 V
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')9 E9 }% ~6 r0 o% f0 o; ^# }! l0 l% a
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
2 J9 s5 Z, V+ twrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
3 x4 x- H* i# d) _' B) I$ owrite('</div>')7 R! D: D8 f* z# w1 p8 G
}5 h" u; Q5 S* k; f
else if (document.layers){
: m, L8 z0 B- [0 p$ c  C/ Q8 @write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
' c3 j0 `% k' M7 fwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
3 Y  L) B$ z# G! B, d* Awrite('</ilayer>')
' f7 Z# W* H" |( N  P/ S- g}
+ W+ d& Y4 P0 }1 x* I' Sdocument.write('</td></table>')
5 a. {: @  h: F, t* h}
4 p2 o. l- c% t9 a8 D  A}. B/ b+ O9 ?) Q
</script>




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