获得本站免费赞助空间请点这里
返回列表 发帖

网页之跑马灯文字特效

//修改宽度
$ ^- D9 L2 R6 T( R  N$ Avar marqueewidth=300: J, A  b# w3 i/ H
//高度
" a2 x/ J% G' v% Z: x2 P2 [- avar marqueeheight=25
: _  k" U$ ]2 }1 i//速度(1-10)* ]+ G/ J: p( `1 k
var marqueespeed=3" i1 e7 E- O9 ?
//背景颜色
; G0 ~# W7 z0 Q2 @; xvar marqueebgcolor="#FFFFFF"
7 U3 ^, ]: b% `//是否能暂停 (0=no. 1=yes)?
+ d4 r4 Y, S: n* hvar pauseit=1
* e2 Y2 ~5 m" {9 |* L( s4 y; j" W8 i7 i
//修改显示内容
4 c* f2 f+ Z& T" |5 lvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'. d* ?2 ?! @' W; H, f/ b
+ F% ]! E- h0 a' s
0 Q$ [3 D8 p* ?; S8 x- h
////下面不需改变////////////, I7 w4 X' x/ n* D$ d
' v# ~6 B$ h3 @
var copyspeed=marqueespeed
' S7 B% t/ k! w2 ^2 _var pausespeed=(pauseit==0)? copyspeed: 0$ O( W" h# ]" P$ T7 B8 |
var iedom=document.all||document.getElementById
. U8 u! _9 `2 [- Lif (iedom)
$ G% V9 p7 K3 odocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
- k1 _7 S! N' R- bvar actualwidth=''0 V* u( e9 b1 X" u- z, V$ q# `
var cross_marquee, ns_marquee- Z) N5 [' ?0 k+ Z9 j% \

% M7 ]$ A, m6 [) e' v- Y* q! W5 _8 t, \function populate(){
" ^7 ^% x4 m0 xif (iedom){( c, d, A6 ~6 X5 R# w
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
+ c  K) f9 @9 I7 J# E6 q: w; Ncross_marquee.style.left=marqueewidth+8- Y8 a3 m6 ]. d. H/ H
cross_marquee.innerHTML=marqueecontent) T5 h) k' z) a6 E- X
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth2 ]$ ]" _! o: {
}4 q/ _* t& D$ d8 K6 M5 b, _
else if (document.layers){
$ f+ E# \* K1 T. O1 l7 y3 kns_marquee=document.ns_marquee.document.ns_marquee2, |0 p- V% K8 {1 o  Q$ {% [
ns_marquee.left=marqueewidth+8
  i8 |0 u8 B2 E& lns_marquee.document.write(marqueecontent)
% O$ F$ ?: A9 p) |, xns_marquee.document.close()* k( ?, Q: N4 `. o) _# Y; y0 g0 }
actualwidth=ns_marquee.document.width
4 R/ E* l" J* C& `' u0 [: G8 C}$ j; \9 l7 N- p# F! L
lefttime=setInterval("scrollmarquee()",20)) _7 b* j% L; o" B( O
}
7 _3 x0 V+ x% s, u, _window.onload=populate
1 ?4 j6 R2 j. A5 n: n$ S5 R' Y! o% h& v5 ?
function scrollmarquee(){
" H7 N1 u! A2 T; U: P# j3 X4 Fif (iedom){/ L2 Y* p* L4 y2 W- K" I
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
0 Q6 D6 w( {, |cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed' \% w& Q$ K' T5 M
else
; _5 I6 H, m( ~2 t! ?2 ecross_marquee.style.left=marqueewidth+8
( p& e; d) b# ~: x6 t$ u' c! H+ @0 N) {2 o: Z
}9 r' o6 I, Q8 m3 ^/ l
else if (document.layers){
4 h* L( o9 V' v; bif (ns_marquee.left>(actualwidth*(-1)+8))
! f2 ]$ ^$ K1 D& K& \* k( _ns_marquee.left-=copyspeed$ E: Q1 ]# c' `
else$ X4 D+ I$ Y, P9 ]
ns_marquee.left=marqueewidth+80 Z) c. ?. b5 f& s+ ]
}
5 }! R$ N- m2 l7 X( H" f}# F- A' C3 F# z  c0 U

' Q" F1 q1 Q+ W% h" k3 @, }: R( Kif (iedom||document.layers){- z# k  B3 `/ v  w! L
with (document){
! C" _* z) c2 X3 e5 Wdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')% l! \" |9 Q$ H7 h+ E
if (iedom){
  {7 K6 s4 _/ ~/ A& c* q  gwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')% ]$ H$ h) e, K3 r- D5 m0 c
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')1 {% X' o9 D; Y8 [& Q
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')' P# n4 N. b: l* n9 I1 M
write('</div>')1 c+ V+ q+ ^: ]* @$ x' Q+ p) f
}! s/ ^0 {/ r3 p2 T2 E; w
else if (document.layers){# x3 c2 z! C/ x1 D
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')( N- h2 B6 l: Z
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
) r: I+ q1 W/ D, j) V5 c2 Twrite('</ilayer>')
; C" ~. S# W& f: ]$ d2 q7 W}
0 Q) _8 J1 z$ }  i7 t3 gdocument.write('</td></table>')
$ F# I7 r7 x" k0 |- i: _}
  r( _7 }" j: Q1 t}
* J% r. w. o2 O: _; `</script>

返回列表
【捌玖网络】已经运行: