Board logo

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

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

//修改宽度1 C; X/ {2 U* A
var marqueewidth=3006 b: |- q! G8 p
//高度
7 S, r7 d5 s/ H3 L! f$ S& G0 @) zvar marqueeheight=25
: h" Y. B8 m9 ]+ E* k//速度(1-10)
; e! _% {- t$ L5 q# H/ h1 w5 Hvar marqueespeed=37 `  a* x0 U* `
//背景颜色
. c; d8 x5 \' }var marqueebgcolor="#FFFFFF"/ D! F0 ]8 N; Q! }; y# [8 K
//是否能暂停 (0=no. 1=yes)?! |* U4 v, X! E$ j; D! q
var pauseit=1
, F: u3 c' I  B6 U7 K$ [6 M1 ^2 P) @( S# n. n
//修改显示内容3 H/ [4 D$ j) M; O+ _
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
& Z  F3 O; C! U3 X$ j2 e5 n4 n: m1 y" r! D# L3 Q6 ^/ `# q, [4 c6 p
5 \& z; a1 w* n3 y1 [/ o" K/ M: J( a
////下面不需改变////////////
* ^, v8 `2 J5 [2 ^. |, ]
+ R* e2 O2 N; p: i6 q7 x& pvar copyspeed=marqueespeed7 N8 x) ]6 K1 l1 e, V+ i
var pausespeed=(pauseit==0)? copyspeed: 0
7 H  P! ~. D" `var iedom=document.all||document.getElementById
9 E, v# o# e! V, c& u, k% ]0 e; Rif (iedom)7 z# `# A, m% o* H+ u* u& A
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')+ D2 K3 L" g# _( f
var actualwidth=''
) y: S6 W, v, u8 {# yvar cross_marquee, ns_marquee
1 [5 ?2 ^" I" l1 \7 q* s7 q# P( j9 \' q) H+ |
function populate(){2 b- O! r- I! H9 a! a
if (iedom){4 d2 y+ y) q( q# A1 i+ W7 q
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee0 [' r+ c4 a: r& n) Y$ m% E
cross_marquee.style.left=marqueewidth+8
: k9 u" ^( z' D: \4 xcross_marquee.innerHTML=marqueecontent
/ _) X" A* t. r& @! k6 Iactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
3 y- l. S2 e3 j}7 h8 l9 l* U* w" ^$ f2 n
else if (document.layers){3 x! r8 h, f% j/ f7 o
ns_marquee=document.ns_marquee.document.ns_marquee2
  C$ ~; R( c  i7 U4 n) q( f9 ^8 \. Pns_marquee.left=marqueewidth+8
7 e  t# O& o4 I- j( B4 q8 K. ]; }ns_marquee.document.write(marqueecontent)
+ z3 m" k. G" C4 zns_marquee.document.close()7 B% W% l. {2 T8 F6 q7 B, ^6 m
actualwidth=ns_marquee.document.width
3 x4 ]  R! l- O. }4 `}" Y# w6 f- A5 k) E1 J4 k2 p3 W4 u0 w
lefttime=setInterval("scrollmarquee()",20)
! N" R$ c2 X; G2 ~0 G}
3 f- f4 F8 K8 h  dwindow.onload=populate( C' D1 n8 k+ m. l7 H8 G) O

7 @+ @& t: V' {8 g2 z9 ofunction scrollmarquee(){
' F; f3 g8 A$ n! f! Dif (iedom){4 a* g2 a1 J, |# R0 g4 N
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
' p) g5 t) Q- t6 [7 Ccross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed$ n4 a* x) c2 K* R( ~3 }
else0 M4 ^2 V) z: c) I: V: R) |! I
cross_marquee.style.left=marqueewidth+8
! c  @  W; u$ I9 ^+ s1 ]3 @8 T  n: x/ h+ j- M1 Q; N" G
}
4 x: e2 M/ }: f2 A, u* Zelse if (document.layers){* k* V% ]6 K% s6 y
if (ns_marquee.left>(actualwidth*(-1)+8))
% t9 |1 l$ ]* Y5 [. p! y- \ns_marquee.left-=copyspeed9 s! `7 ~& O5 a6 q1 S7 a& S
else
5 ^* t, f4 O( s. e8 v6 L$ [0 Rns_marquee.left=marqueewidth+8
# f6 p! @' Z6 v. n. E1 {  z2 u}7 f/ T0 P! \2 I7 @9 o3 t
}0 W! G' x# S- k0 _4 H: j( m( E

8 k( B" o0 j7 [if (iedom||document.layers){
5 z5 b0 C' ^5 _with (document){
$ i  n, V1 o3 Jdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
3 a- D/ `2 ~) D2 D; {" gif (iedom){
! j/ k  \: M: ~6 I. Lwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
1 Y6 }  z) w( d* Q6 s+ |# rwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')  e6 L: S1 ?' n* l- J" N( p; e* C
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')& L- ?$ N7 S2 i/ X- ?5 O4 t" O
write('</div>')
& ?7 W7 d# H4 Q' Y- R" X}& o& w) E1 w( ~+ A: i6 A
else if (document.layers){
" C6 {$ v- O9 o/ Uwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')* K4 {2 \2 U, h
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'); t. Z/ V! O: N! S
write('</ilayer>')# m/ Q& \  U  i& u8 E
}
7 Y3 h5 G2 f4 k( _, K; F  c. {document.write('</td></table>')
9 k( o5 {6 r& K}6 }4 N9 O; p0 L$ U" i2 a, k
}
+ y, g8 ~, k4 \4 O1 B</script>




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