Board logo

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

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

//修改宽度& U  q( D; g/ c" |2 f8 p8 Y
var marqueewidth=300
+ [( ?! {6 D# k6 M1 V* s+ d//高度
  R8 d" Y. A' i$ nvar marqueeheight=25
- B+ s- H% p, @: ^% q+ _( u& W//速度(1-10)" T( N# f: R( v) k  W
var marqueespeed=3
( Z, i. h9 e( o) w# X5 p& b//背景颜色
- {6 l# E6 J: H  x+ P1 L# ^var marqueebgcolor="#FFFFFF": ]: x* y1 `5 \
//是否能暂停 (0=no. 1=yes)?
7 r8 ~7 h- ~1 N, vvar pauseit=1
* l7 ]% ?  a- ^) Q- N$ e( A
  W0 X' Z, P* q" E//修改显示内容
+ d0 R& p8 q) K% Y& @var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
( M3 ~6 W6 t* [0 N
5 G4 J5 d! _, y5 a0 X; h8 P
1 G; _4 h# X: D- c  }- j5 ^0 ^8 f////下面不需改变////////////
- p) f$ h. Q1 P! P3 P1 e" G
4 v1 h) i8 I' \1 [var copyspeed=marqueespeed9 w+ L8 M4 `4 m% h
var pausespeed=(pauseit==0)? copyspeed: 0
9 U# I) o  y+ s+ B: w9 }. Ivar iedom=document.all||document.getElementById. z$ q( K# X3 p% {3 _6 k( _( n
if (iedom)8 M2 l6 ~, f/ c0 A/ q4 j, o
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')/ X/ o- Z$ \8 a- k) p& A8 X1 t
var actualwidth=''  f; Y3 ^' ^' Z' k% \" [
var cross_marquee, ns_marquee3 c" i6 P& j- U) r
) v3 D8 P& {4 j, V7 r
function populate(){1 K+ ?' H; u, p1 h0 @" V( F
if (iedom){
; i, g& M1 D+ F' F4 Ocross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee: _+ t0 ?3 l7 h: F' n) d
cross_marquee.style.left=marqueewidth+8
2 `7 J$ V  R  r4 V% Ucross_marquee.innerHTML=marqueecontent6 b" a1 e( ]9 l2 I% @
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth# d. `  h$ a  s7 n9 ]5 t
}/ D4 t$ S8 Q# q$ |8 `% E( Z  J
else if (document.layers){, h: H( N# @- O1 h* N* z+ ]
ns_marquee=document.ns_marquee.document.ns_marquee2
9 U6 z2 ]$ u; Q* D& y, r9 _* }ns_marquee.left=marqueewidth+8
0 Z) X' m5 n/ ^( g& Y5 C' a+ C) ins_marquee.document.write(marqueecontent)* V2 x- G% E+ l) e, ?8 S; E
ns_marquee.document.close()
1 F- T( B; q9 j; u$ S. Wactualwidth=ns_marquee.document.width
/ b) z' x. E7 w4 B( r0 J0 q}7 G" E' Y7 R! A: I: e: |+ p/ G* [( n0 v
lefttime=setInterval("scrollmarquee()",20)/ X# s/ ]/ k1 G, J8 \. e; Z
}
; b4 O2 m4 a- j- K) x6 awindow.onload=populate/ G  Y$ ?! |5 ~7 |: O
, K+ Z+ D! A- M0 ^+ n
function scrollmarquee(){; m: s! `. b# o. `, K3 R
if (iedom){; j5 d0 V" ^5 V+ t4 g: E
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
6 ?/ r8 R9 O3 }) z: Pcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
; O  q1 ]1 @" I- z1 ^else
  C( J) W7 V" T/ r7 Fcross_marquee.style.left=marqueewidth+8' j3 e+ S2 K" {/ \

& i0 z; |2 \- O7 e}
9 w% ]% R- `5 _$ ~3 i" _+ Yelse if (document.layers){
+ S% A+ r# n9 c- _2 u3 @+ Cif (ns_marquee.left>(actualwidth*(-1)+8))
7 D/ J, S) K1 K+ ens_marquee.left-=copyspeed. z* y6 `: `( w# H' s. h1 f
else
' q- i, j7 L8 u' j$ V* ~ns_marquee.left=marqueewidth+8
" y0 J: ]+ @% |& U% d/ Z0 o}& I- N' z# K1 t' V
}. x( F8 |+ \. e0 B0 H; e  t

( X* D& C7 S: @9 v. _5 B* _if (iedom||document.layers){4 u0 `! p+ r+ N5 g
with (document){% h9 m( L* ~6 M
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')+ U( E6 x5 r) p% H( _0 B8 ]* f
if (iedom){5 v" U1 A& k8 |. u0 i
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
' s, n: v+ ~8 e+ h5 ]5 s( C  U# Bwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
" }: ~8 u6 j" Wwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')& @8 M8 g7 R) u
write('</div>')/ P! [; _& Z$ y: Y3 t
}, Z- `# ?  Q, q  s
else if (document.layers){
9 Y' h9 t; M2 ^4 y  @, ~write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
+ F$ z; f$ Q5 G/ X+ Cwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
6 h+ P! ~" b3 Uwrite('</ilayer>')
4 v9 G1 l0 @. A}( S/ o1 V& H# b. n" K* d, A5 ~
document.write('</td></table>')
0 D3 ^) _# c% n}
2 L7 E- ]' x! G. O8 I}
4 G. K' v, u6 _- |</script>




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