返回列表 发帖

网页之跑马灯文字特效

//修改宽度
) Z+ a  O! I" c- w3 J, _. Gvar marqueewidth=300
5 M4 H: t* v+ }+ W' G2 x) j8 }//高度
- \+ v# Z6 }5 pvar marqueeheight=25
, }. [6 c, b1 Z* @  e//速度(1-10)  _- z) e( y) Z$ x6 H1 i3 D
var marqueespeed=3
3 Y% ]7 N2 `6 r//背景颜色
8 j7 ~$ j" {9 |var marqueebgcolor="#FFFFFF"
7 R$ @1 a' h8 V, {# w# Z//是否能暂停 (0=no. 1=yes)?" `, s% s+ J4 s5 @0 T
var pauseit=1% f/ E2 w& \. U" d1 s- ~7 Q

' ^* P0 B  B3 f  e# J. F//修改显示内容
8 V) x% Y/ ~8 ?6 Q! P* Jvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
6 `2 ?$ r* e* g8 ^% i; s+ U1 n8 R" f: ]$ h! s

7 V. G2 S. ^& Q* I1 h$ s7 C////下面不需改变////////////9 u% e+ h" {$ f. Z# M

5 D: o! d1 [% J, J. o# kvar copyspeed=marqueespeed
3 {% d2 a/ b) ~  Vvar pausespeed=(pauseit==0)? copyspeed: 0. F0 j4 S8 B' N( e- d& f! P
var iedom=document.all||document.getElementById
8 S  i/ v3 E, }$ u. H8 xif (iedom)
6 V2 |: _& R6 k4 Z4 pdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')7 |. I. m  L  r# ^
var actualwidth=''0 h2 c* q9 e6 \; c, `" m# a2 t' Q& S
var cross_marquee, ns_marquee
6 b9 j. V7 W% M! `$ J4 o7 k: F( p- y# G# `8 A
function populate(){2 K: }+ _: Q# o3 _
if (iedom){
4 A' @( m$ ]3 H3 q. Z5 kcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
9 K/ B" `/ r* R. xcross_marquee.style.left=marqueewidth+8! f' `, G7 Z# ]; O7 r
cross_marquee.innerHTML=marqueecontent
+ }5 A+ U& q, v  N3 ]3 W/ {actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
& `* d; j" F5 z/ @+ ~& e- i}
: b4 Q0 J8 X9 F; j) i  |( helse if (document.layers){& [) {$ V, `  Z" p0 A/ ~
ns_marquee=document.ns_marquee.document.ns_marquee2
1 X1 y& O2 y% ^' l% L7 l! Rns_marquee.left=marqueewidth+8
0 i. B& h* K; k9 j7 l2 ons_marquee.document.write(marqueecontent)
. a: j; b8 D! v; ^* S3 \( ins_marquee.document.close()
# T9 u3 g1 J* W6 ?0 `& Ractualwidth=ns_marquee.document.width
; w1 w" y) M8 A7 }$ }6 a$ W2 l}* }! \% D& ?. _" p
lefttime=setInterval("scrollmarquee()",20)
' u, ]3 {0 k" ^3 Z$ z}
. O5 @! ]* c; {! a! S5 @window.onload=populate! h! h: g) T4 y, a% l* n

$ X# t: i3 {" c7 o4 X8 rfunction scrollmarquee(){0 c1 x, v: w2 v$ o- L! j+ l7 q# N
if (iedom){
' l" C& @# q4 b3 ?% cif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
1 j/ B, C% G) J1 G2 Kcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed6 c& U1 Y; w0 s* t' s2 N2 H# ]* |5 l
else
$ |& x, N/ M7 ]: w# E3 A3 Ecross_marquee.style.left=marqueewidth+88 C3 i5 G8 O; ^0 s! j" q3 C
2 z$ W: j, Q+ ^5 z, |; L, r
}- q$ O- J: T+ w
else if (document.layers){2 A8 [! {4 Z2 @3 ?! S2 r3 T
if (ns_marquee.left>(actualwidth*(-1)+8))# Y/ ?* {  |6 O7 [" P0 b+ G' H6 o
ns_marquee.left-=copyspeed
7 ?5 o' [$ T! F$ @, a7 i+ y! zelse
( @" b( y$ v  {) ans_marquee.left=marqueewidth+85 T; I" u, j. h& n* a) O
}2 m4 p5 ~+ t( I# ?5 H
}
5 {/ q6 L5 a& D! y7 Z% g* l, j5 ]0 r" G5 J. F/ k
if (iedom||document.layers){
# p+ N# G- g# q7 g0 H) Hwith (document){% _# M- y5 b% V, ~$ l3 e
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
6 X% y) |  |7 N$ L4 A% Sif (iedom){; S; Y2 e: y$ u# {3 I1 `. y
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
- `" k: U  I5 ~write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'), l: e: O# k% D; Q8 C
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
& o0 r+ N. z8 ]% @2 qwrite('</div>')
' r" E' G8 T" S3 i$ s+ u}8 Z- {4 h! k$ _- R! t
else if (document.layers){
& f6 L0 R  P) Z7 Z% d& Swrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
3 d! V( A2 {2 @; J7 b3 Z- bwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')1 h, L; @- `! W1 S* v; x
write('</ilayer>')
3 m# [/ A9 k  R# a}' L& a; U# Q* e: k6 ^( n( I
document.write('</td></table>')
2 ]% ~+ j* s& h}
: O; b. \$ U: B: I7 `7 |$ O}
. q) Z9 F" s- R2 M0 T( X! q</script>

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