Board logo

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

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

//修改宽度
, ~, q7 r- Y4 a8 v5 ovar marqueewidth=300
0 W" ~9 t$ o* g//高度
8 Y# c  \* C: l* J; dvar marqueeheight=253 _! |  T/ |% Q" q
//速度(1-10)
! C# N3 q, P: w$ T* {var marqueespeed=31 @: z0 F& f" Z: C. r& F
//背景颜色  D3 O3 X0 x0 h: ?, f2 T
var marqueebgcolor="#FFFFFF"
& ^% @/ V& {8 X: {! r5 |//是否能暂停 (0=no. 1=yes)?
7 u/ h+ o: I5 @( w6 F+ n& Dvar pauseit=1+ T! h" T9 m& ?8 Y+ |6 C* h
1 K- C- \: m: K7 p' I1 A
//修改显示内容
8 l  D4 T9 v" w* y  P8 a! h; mvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>': W) J, M; ~$ I4 m; x) q' ^

4 T3 n9 G) b# O+ ^1 N' Y% v4 ]2 I
////下面不需改变////////////
! E: X- m0 w$ S2 _/ ?+ D( t. o5 K+ u- i8 N% ^+ N% B
var copyspeed=marqueespeed
/ Y2 [7 j# P( O0 K+ f. Rvar pausespeed=(pauseit==0)? copyspeed: 0
9 m3 y$ H" U# R3 Wvar iedom=document.all||document.getElementById
1 ?2 P. o5 |5 o' qif (iedom)
# y3 K8 e/ {: d4 W" u2 mdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')4 {) F, W5 x6 g/ {" ^$ C- V' t
var actualwidth=''
5 y: C  m+ i+ l8 a3 ?0 v* a) zvar cross_marquee, ns_marquee
+ w# \+ V! w' J& n3 l3 e! z# t4 K- ?( _
function populate(){
3 N- X- a% `' ]! Z$ K: H! K  K0 kif (iedom){$ h6 x$ x# q3 C9 O) s6 J$ q2 B
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee; Q4 X" S, {6 Z
cross_marquee.style.left=marqueewidth+84 X) d- _6 A: F7 V$ W
cross_marquee.innerHTML=marqueecontent
7 F% D% T2 m0 \" ]7 Nactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
8 N# P. m( E( Q; O6 i( Q0 G}" Z% v6 g" m2 ^; e# G; l; \& c- H
else if (document.layers){; m% Q- F& I3 j" v' ?+ W
ns_marquee=document.ns_marquee.document.ns_marquee2
2 N2 e+ [' Z! O: @4 vns_marquee.left=marqueewidth+8- x) W5 A* Q5 Z3 C
ns_marquee.document.write(marqueecontent)
4 v4 p' V& f5 R6 I8 P+ _2 `ns_marquee.document.close()
/ M7 d+ [# F3 P1 y. c3 G8 uactualwidth=ns_marquee.document.width; z, W. s* h1 W2 S' S6 K0 ]
}' ~) }  G, _. g) q
lefttime=setInterval("scrollmarquee()",20)' e) b6 h& Q& f: Q+ O! J4 ?' P, A
}: C/ X1 L3 Y* n3 q# A
window.onload=populate% L$ s- W6 s$ X6 z+ @, i% G" o
" q% @5 K2 K" M  W, W: u+ l
function scrollmarquee(){0 ~4 `8 T4 n! f# L$ O
if (iedom){4 p& Z3 }9 X! i1 }7 k1 g9 @- R
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))5 U) Q3 {9 k0 l9 \& p9 p$ A
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed# r- `) z6 T+ O
else: v/ B- m) j' T9 s6 H# z; ]
cross_marquee.style.left=marqueewidth+8& l' [0 R1 U; u) H

- j0 H( B2 `* [+ y}$ f( H+ y! Q. B
else if (document.layers){
3 p0 ]# S3 y5 o( oif (ns_marquee.left>(actualwidth*(-1)+8))
' e' v# A& {% u! n) H* X6 Y& vns_marquee.left-=copyspeed
" F' ]6 H/ [) W+ |8 relse
6 D4 n, g5 E) j- U8 ins_marquee.left=marqueewidth+8
, c3 Z+ d  R4 a2 m) g1 T}: x0 d! e' K6 h8 V5 e% S
}
" P% ~" N8 Q" g& q& ]  }3 P% h, H7 V' E; ~6 B: g
if (iedom||document.layers){- X; k+ S& r+ L0 [; a* }
with (document){
! l- V1 L+ [* e9 B6 j( Bdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
! R; c9 h( H1 yif (iedom){
. j' R: f1 M% k# E6 [  jwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
5 F" Z* k5 ]+ Y7 b2 @write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')/ M  y( v- L8 f; b6 x! {0 K
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')* u. Q3 Q/ S3 i3 B$ r2 Z. l
write('</div>')
: ~/ `7 D: h: {; A}7 P6 ^" v" ~& x+ X% ^! ?8 m$ W. I
else if (document.layers){/ A& W7 e" P3 K  {9 [. b' x
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
; E* B4 [. l4 x) `8 q# I3 _write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
+ p9 v9 d5 j/ [+ B9 g1 L* T  hwrite('</ilayer>')
6 N; _3 O" ?, g}
9 e& v6 u4 R3 Q" o2 hdocument.write('</td></table>')
5 Z3 Q- ]$ M6 r, Y" ?8 o7 N}
& _9 S- B5 V  e8 p1 Y! R5 Q. S6 S}
+ b) s; [# u. V. f7 v  E: K</script>




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