Board logo

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

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

//修改宽度
1 r& V4 V) ?+ Wvar marqueewidth=3003 u. b6 s  v  K, B8 @) p' `/ q9 T
//高度1 D+ V4 I5 s! ]2 [' L9 ]: A
var marqueeheight=25% s# C: I3 L( x& Q( n! _0 Z
//速度(1-10)
: K; t. V# Q8 x( @) ]- Xvar marqueespeed=34 C6 a  V+ ~0 r0 z! _/ s" A
//背景颜色  C  O. S$ C* C6 R8 d
var marqueebgcolor="#FFFFFF"" I3 |2 g+ I2 k, m/ X
//是否能暂停 (0=no. 1=yes)?: t+ u7 w  u5 S. q1 }4 v
var pauseit=1" S$ @: T- f4 z9 d9 g: Q
; E6 P5 T0 d) V9 O
//修改显示内容& r1 ?8 o* F# `! X- o5 X
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
/ w' c: g+ L) {/ {
  u4 a  A' x% r7 Y7 [( `9 z$ t) p- x2 M% L  x5 [' x
////下面不需改变////////////
% ]# V$ _; N# }* G- e2 f1 e
0 d0 E: K! z* w, j# N% Q! ~: jvar copyspeed=marqueespeed
" y  a% [( K$ w/ Bvar pausespeed=(pauseit==0)? copyspeed: 0) y' Q0 e3 s% t/ |. W3 i) ~
var iedom=document.all||document.getElementById
, Z5 O" J* Q( {if (iedom)- U/ t( y$ q8 r% \  A9 a% N
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
" W$ z  m0 {8 ?  W9 Wvar actualwidth=''
0 H' h9 ~  b: y, h1 T' kvar cross_marquee, ns_marquee
1 N* z: o# W. O$ J+ ~. D# x* O: X
3 D  ^' p2 [1 {" @: ~+ R. S! Ifunction populate(){
5 ]8 E: }6 d8 r6 b0 Q0 k1 L# G0 E7 Xif (iedom){
4 u. g$ x, \' E$ a2 Rcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee' B8 P1 |% `0 c/ v" |4 c
cross_marquee.style.left=marqueewidth+8
2 b& g' E3 W4 Ecross_marquee.innerHTML=marqueecontent! P# e  k8 S7 b: q& T4 U2 }
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
0 @7 d. C- G+ V}
# T# l! y0 W' L$ Y4 i: Nelse if (document.layers){' p0 P9 u3 i$ H, \6 U' r- N9 m
ns_marquee=document.ns_marquee.document.ns_marquee2
' l0 L* A6 c* Q* n6 h- _  Y7 E, Y. fns_marquee.left=marqueewidth+8: L  K1 e; o' O; G: v
ns_marquee.document.write(marqueecontent), M! m* R7 g5 \6 y
ns_marquee.document.close()
6 R7 a7 u: D2 ]! \actualwidth=ns_marquee.document.width: o& f9 X" {3 w2 _* g$ }# R
}
0 q+ W- J: P3 e% X% j  i* |% P2 mlefttime=setInterval("scrollmarquee()",20)% A, C$ l8 z  b: g* ]
}
) l  m. w& a+ B6 g. W  k, Twindow.onload=populate
4 _1 R( t  `9 ^. g0 ]9 s: W6 `
) J  n9 g" \7 z# v( D3 Zfunction scrollmarquee(){; ~) h8 a' |% J! q. `1 I
if (iedom){) E' T) k! |! A$ J: M0 Y$ p
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
" {5 r* U( m) A) v# Xcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed' `* {) }' n2 G8 z
else
9 C/ ~( W; L2 B& n$ e. fcross_marquee.style.left=marqueewidth+8/ M! O8 {* P+ i1 d6 z: |) Y- J5 n

0 D' G+ \9 a+ _}7 W3 b9 W2 n) S  L' ~) l# ^. m
else if (document.layers){
( |& y; C8 e& q, K0 Aif (ns_marquee.left>(actualwidth*(-1)+8))
" T! u! x: e9 v- V! P( ans_marquee.left-=copyspeed* V, q; N$ O( [: ?
else1 f: ?% j0 o6 K) [9 x
ns_marquee.left=marqueewidth+8
0 E. g1 r+ X$ T! r, l. Z* \}
$ x$ A4 N1 b7 u7 ]: ], p, M}: A9 O6 x3 ~$ l. G8 ]
, |- Y9 N6 {2 v, M$ `7 p
if (iedom||document.layers){
+ q6 i, {, X2 v$ ^; swith (document){
. o  U% T2 g; Rdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
( b3 L2 O0 v% T/ aif (iedom){+ t7 u) E+ Z' J  O; d
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')' ?, g( f2 o7 U* `- b# d
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
) X( r; y2 i  B8 b: ~% d% Vwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
8 ~& _( Q( B* Y8 P+ C7 D1 jwrite('</div>')
; u/ w! _" Z) M! X. m4 R}; X$ k  o# _& a. c% f/ J; Q
else if (document.layers){  n  L2 k3 [/ y& E+ Q
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
, n; N" G& T& y5 ]7 S) Owrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
' s2 [$ f4 Z- k0 \* t1 U; awrite('</ilayer>')# e! Q* O# {& b( V7 S' C
}
. B7 H( ^# U9 O# l6 ^9 Wdocument.write('</td></table>'): q/ Z( N# J- H2 Z* {2 a
}& {) T2 i7 N+ M1 S+ L) n
}
  {( t+ f! o" }  ]5 _& E</script>




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