返回列表 发帖

网页之跑马灯文字特效

//修改宽度
7 r" u  V+ w( N8 Dvar marqueewidth=300
: c, s. m! n/ F* a" A//高度
: p9 S+ R9 a8 T* B2 |( K$ s7 vvar marqueeheight=25
0 y( L/ v/ z1 q- r//速度(1-10)
/ M/ E5 i1 [% R" L3 {. _var marqueespeed=30 Q6 ~+ j$ J  I4 r
//背景颜色3 L. ^! J3 q1 }$ S6 x
var marqueebgcolor="#FFFFFF"  j4 w! X# N' S
//是否能暂停 (0=no. 1=yes)?, t4 U: [, v  q: S
var pauseit=1+ ~% D2 i: K  V% c- a

: `" j7 G+ O/ }//修改显示内容
$ s  k# M0 ?. H! _6 G, S4 A5 ]var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
- ^  J/ H5 e6 R# o! C- |* o% \. C" d  \# L% g5 n

8 y2 M5 F% T& M& J# A( K  O////下面不需改变////////////2 F( Z( x, \3 x; l  J& U6 N7 D1 c4 _7 @

0 v5 Q, ~5 C, Pvar copyspeed=marqueespeed; G4 v" q) N9 Q8 L/ ?7 [
var pausespeed=(pauseit==0)? copyspeed: 08 Z5 J! z6 R2 N/ L
var iedom=document.all||document.getElementById
9 u! n6 d6 ~3 j% h4 v; @if (iedom)* h) y2 y- f3 Y7 u; L
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')# _' i/ F5 z0 ^5 \& n5 a" n) r
var actualwidth=''& S7 f! v, T8 c0 K6 P6 k7 v6 b' g
var cross_marquee, ns_marquee
3 }2 }$ P0 `6 f9 @  _& H+ K' d' o: X# p" A/ ?/ Q
function populate(){
; u; v7 G5 p+ t4 s% x0 R: mif (iedom){
2 ?& {% N. {4 b5 icross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
% T! Q- ^' @# N# ^% Dcross_marquee.style.left=marqueewidth+8" d# q  A2 N+ H, o' z. r: M) ~
cross_marquee.innerHTML=marqueecontent
0 Y0 Z. g% }0 s( N' |0 I& `! nactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth+ K; |7 ~2 j5 d6 M6 r: ?
}
" h( u+ |2 V; r5 q% t, g$ felse if (document.layers){6 ^7 t% `* e" ^& B
ns_marquee=document.ns_marquee.document.ns_marquee2& a$ [; I- ?* H5 `5 t0 S8 J
ns_marquee.left=marqueewidth+8
6 K* C# A7 L6 W1 x' n. `0 fns_marquee.document.write(marqueecontent)
5 T/ D) I; A- I+ M0 f& Rns_marquee.document.close()% T/ p0 g0 U) U1 ^9 k
actualwidth=ns_marquee.document.width( q' W6 V7 i+ d2 ?$ M% `  S2 o
}
7 T2 \0 |$ J4 e  K0 W, Dlefttime=setInterval("scrollmarquee()",20)9 v/ F! ?  D" U' C2 v. h
}. _& \9 {2 Z: H, V6 Q4 O) U( h1 b
window.onload=populate& O: T# v8 W5 I  ?6 H

( L: p4 ?  \9 {" ~6 l) X1 ufunction scrollmarquee(){
0 R6 P* M# {# Aif (iedom){
6 k9 n% ~7 h& \7 v! [if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
  J. C1 G, o) Y. C: bcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed2 K! g) Y* \5 O) i+ X7 V; y- {
else- \7 o' R- k5 u; f5 s
cross_marquee.style.left=marqueewidth+83 @4 G8 W, q9 S4 k

# B# V, ]5 A6 A0 A6 V; B% D}
3 v. K1 W3 c, Z* t  G6 Nelse if (document.layers){
- ]2 o# p0 @8 wif (ns_marquee.left>(actualwidth*(-1)+8))  S& _% m7 K2 j) j3 \; a2 @1 h5 ~
ns_marquee.left-=copyspeed, j5 Z) v& ~- Y& |: ?# d. H
else( N- z' r2 o: Q4 ?7 ^# h
ns_marquee.left=marqueewidth+8
& z9 O) G" m3 `- q9 P}
1 o; V: o7 E1 ?4 i+ F}+ H4 g* D* I, w6 p! i
6 G- B  h3 [4 X5 z% A; Z
if (iedom||document.layers){
0 P. q! h( ^. z0 S& ^! o/ c6 Uwith (document){( G: c2 K4 A) O) x8 m# G0 J5 t9 b
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')& `4 a# H# V# `
if (iedom){# l9 R' c- {0 X) @8 T
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
5 o* O! q/ b( g/ {* w7 k" T5 pwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')0 r8 O& P8 S" E7 {9 Q& {
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
. r  l& V* J( r! J) V" Iwrite('</div>')
0 m9 n7 R9 H7 S- ?* \% @}  Y, G+ q4 {7 s" B
else if (document.layers){
& _( G: ?7 V" l' Y! x! A& mwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'), n4 i, P4 S% I+ |, I
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')! Y. q. n6 H! x6 `
write('</ilayer>')3 ]# X0 z2 E9 n' t
}, |$ G1 V$ M$ z. Y
document.write('</td></table>')- s, V2 I- w6 @& z' E6 ]$ {. j
}
+ u) T: i3 t7 W, M! b, U2 t}
7 w& N$ d' h9 F; K5 G8 f) B</script>

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