Board logo

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

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

//修改宽度) Q- A% V' x- }' Z7 T6 @
var marqueewidth=300
, ]6 B( d% p& }//高度
& c# F! \/ E0 y# ?) Nvar marqueeheight=259 j* n0 n. w7 p9 D: C
//速度(1-10)
6 u% \; ?! C3 L, ]- ovar marqueespeed=3' D/ Y, q1 H6 N  o: |6 N$ V
//背景颜色& ~9 F8 E' Q! v, ^
var marqueebgcolor="#FFFFFF"
9 r/ E2 ~# k% s" `//是否能暂停 (0=no. 1=yes)?- v  l* x$ F  [# ~7 \) a6 z
var pauseit=1
7 n) a- D: y% f# v! k. f7 L. v2 N" T: J/ ~* d) r% Y' I
//修改显示内容
5 ^; L# \* |) i, }# ?var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
& L! s! t! ?: d  F6 B0 W) E
# A( {' \" u7 s9 I6 [, Z) Q% u
7 o; f# m2 R$ I  F////下面不需改变////////////8 d$ ?2 q* M7 Y
4 G9 Q; _, Q: s8 v
var copyspeed=marqueespeed
! ^$ _; l7 W2 Svar pausespeed=(pauseit==0)? copyspeed: 0. C( \( J# |: {
var iedom=document.all||document.getElementById0 K% H* w2 C$ z6 R" q5 x' l6 {) U
if (iedom)& D, ^/ {6 x8 i8 w7 l, `
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'): e* E: E# F! e( [1 r% a& l+ C# d
var actualwidth=''
; e, ~# C* }3 l9 L, }( {9 Hvar cross_marquee, ns_marquee2 z4 k4 Z& j+ J: C. b; i
" p- Q* V+ q: [+ w
function populate(){9 B* g. ~+ m% w7 ^6 R
if (iedom){* y2 U" ?4 p8 N; Y+ R7 A
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
5 z' T9 w/ w" n' ]8 l1 Scross_marquee.style.left=marqueewidth+8
3 [  ^! N9 P9 }4 b9 J3 Ncross_marquee.innerHTML=marqueecontent) [& o- Z: D, m4 r( N* J5 }
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth8 e* n* A; o& Y" x% N9 Z
}
( j- M: l! J0 s$ u% c, x! {* C. Melse if (document.layers){
8 N* X( y! V$ [+ b2 Hns_marquee=document.ns_marquee.document.ns_marquee2
2 U2 b  Z  U- |+ ?( ]ns_marquee.left=marqueewidth+89 i8 N4 _3 y! r# i! Y# u
ns_marquee.document.write(marqueecontent)7 y: L0 n' T( ^7 V7 x' M  A+ L
ns_marquee.document.close()
& t  \$ b+ a0 O, T, L) lactualwidth=ns_marquee.document.width
" }3 p6 W3 m4 Y, u# L3 T* I}' @5 S/ E- Y/ d" N
lefttime=setInterval("scrollmarquee()",20)+ O5 o' Z- N9 _0 d) i  B' H! p2 U. t" }
}
+ v- U) a' p* }# j- ?* {6 h' q$ Ywindow.onload=populate
, U/ |$ ]0 ~, _) L/ Q8 t% h
; U* p7 [" e- n, K7 ?1 [function scrollmarquee(){  n( Y3 w! I% |
if (iedom){
0 j5 {( X0 Z1 z) S8 J! Bif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
; [3 @/ e. H6 q8 j3 Fcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed% b4 F# j7 S; ]2 `
else
' I8 t8 d- {2 C% V. E5 X$ ^. jcross_marquee.style.left=marqueewidth+8
# q# V- ]7 r. b- S' x& T$ s+ f
; ]! y( F/ l* F, I* W}
9 j( N, T/ r% Kelse if (document.layers){% p: w6 R' I7 v: A& H: C4 O2 j  n
if (ns_marquee.left>(actualwidth*(-1)+8))
& W2 Z2 J% k& |: ~7 h3 Mns_marquee.left-=copyspeed
7 Y* @( _( }4 o+ Yelse% Q" F) Q/ \- q0 b4 e5 g& F
ns_marquee.left=marqueewidth+88 Y6 R# e" y' g
}0 g2 a: G- o7 n3 @# o1 Y6 w6 T% S
}
( y" f7 e; ]' z1 z# G* e. P' h, ]1 p' h+ s) J
if (iedom||document.layers){
! {3 O8 ]! U5 g4 H  L- Vwith (document){
- ~6 |1 ^3 R4 t9 h) [+ e- g5 Udocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
- b; k$ Z  p4 e2 x1 |5 r7 bif (iedom){
, e$ u/ ~+ ]1 Y2 P; V! wwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
  X3 Q+ R" d! L) \7 j: [" Mwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')& w/ a3 T3 T3 I: f/ G6 z
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')2 a- d  \% O- ~4 e: l; s! a
write('</div>')/ P  ]8 j' o4 P) p# @2 s! E( \4 d
}( l+ ?' P: h4 Y7 K
else if (document.layers){1 Z; `) `# Y0 H  {' I
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
5 q% Z+ C9 |/ K4 k. w1 \7 rwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')# s% N. B, f5 B& K! }. U& x4 H
write('</ilayer>')
2 z+ A4 M; s8 H2 ]+ `}$ L, M9 }# \  G+ C1 }4 s9 q$ r
document.write('</td></table>')
6 _/ J) p! m, w}! i5 s: g; v3 P8 Z+ A' {9 k
}
7 l- s( l* l! W4 u0 w+ }0 `9 W% `</script>




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