返回列表 发帖

网页之跑马灯文字特效

//修改宽度
9 i2 `$ {$ ?- g7 D, @& u# tvar marqueewidth=300
, B$ R& E& K+ F+ d9 T8 W* j//高度
  K3 R5 t2 s) \7 _% S, X8 f, Xvar marqueeheight=25
6 u* [" W: v  w" S8 M+ z6 G  X8 k' _9 T//速度(1-10)3 J% B0 B- k) K" P
var marqueespeed=3: K, M1 d  M% q7 }
//背景颜色" H. W3 A! b2 l" I1 H
var marqueebgcolor="#FFFFFF"+ W- F. [' D" z! `( R6 S
//是否能暂停 (0=no. 1=yes)?: T1 ^  V. m; Y- H& I
var pauseit=1
7 j# a: b  A1 v9 a9 k9 ^9 H& g7 Y; ]  ^6 b4 v; v6 t
//修改显示内容& E1 R& g3 Z9 r; s  F1 h' V0 j4 ]
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
: b! F  b9 \# i+ o
% j6 `- e- Z  `( R# U; R/ X* [# ^  N8 `: t8 i4 `/ T
////下面不需改变////////////! m5 _  I2 V& L6 _5 {4 i5 [
! ~' L  }1 R, j- B# z
var copyspeed=marqueespeed3 _2 \" x+ N* h. A2 K- L+ l. t
var pausespeed=(pauseit==0)? copyspeed: 0! }" m) S% W: D, J- \2 u! U
var iedom=document.all||document.getElementById6 {+ z0 |4 `& a  W/ i3 o
if (iedom)
5 r! |8 x' w5 f) D% `+ ]document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
- k! W: ~$ Q) r1 F8 s) Pvar actualwidth=''
& Q5 Y0 e: i8 K; E% Pvar cross_marquee, ns_marquee5 h2 V& e7 x2 X& s0 I3 I0 k' I

0 @5 I" |) g4 z) W# Y$ W9 u# Nfunction populate(){
" v/ a# ^- ]3 d! n$ [) [if (iedom){
. z( C& ~( c( v8 Lcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
( U* a& V% |# K8 Bcross_marquee.style.left=marqueewidth+8
* D8 c, a1 n# V) [cross_marquee.innerHTML=marqueecontent. d5 t3 E* Q- C$ G' `' a" Y
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth; {( Z4 ^6 Q1 d. z
}
5 s  c3 R3 M2 k. Belse if (document.layers){6 [! i# w" X! A: N, ^
ns_marquee=document.ns_marquee.document.ns_marquee2
1 K! d' F" _# M, q- wns_marquee.left=marqueewidth+8
/ r5 W% J9 v5 K( |+ Nns_marquee.document.write(marqueecontent)
3 h7 I' s; ^& S4 B& ans_marquee.document.close()
( l1 X* L! U) y6 G  Cactualwidth=ns_marquee.document.width0 D3 \- ^) f4 S% H' k
}% O3 F: `% i3 u0 B8 r- N0 k
lefttime=setInterval("scrollmarquee()",20)
! {0 I7 w  D9 x# u7 J}
0 G8 a" D& f) Y( B4 p6 W/ J+ Bwindow.onload=populate5 H4 X8 [4 s3 d
7 N% A- F  e- r& C
function scrollmarquee(){
$ F& a& u; s! [0 S' v2 wif (iedom){
: {- `* |& z# u. ^9 t. j$ \if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
( @! J! @' d+ scross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed% v6 u& ~  l* T  b
else. i: a" `$ H6 @- z5 ~! {" k) v
cross_marquee.style.left=marqueewidth+8
' h8 [7 q2 s+ J: ^
3 W2 z- }7 d2 O& w3 m}9 o$ u4 {/ H  k  j
else if (document.layers){/ u% d8 V; K! q
if (ns_marquee.left>(actualwidth*(-1)+8))! U( L' Y- a" Z) {
ns_marquee.left-=copyspeed
. d# S5 O# g! ?& i! Uelse6 A" H. k' \! O4 n4 b
ns_marquee.left=marqueewidth+8
% f# T! r+ w! M% H* O}
4 C8 C+ d( G, x' H}
  q% r: |6 R- Z; O
/ H' U7 f: Z  E5 s# f% i. \if (iedom||document.layers){; {& M8 S: k/ k& T7 Y* e3 _
with (document){
) @2 ~) B! t/ Y- e2 zdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')3 K( V, p' y" W; u
if (iedom){
5 M4 Y% m$ B# n" a) X1 l) u' gwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
( v7 b) I- B0 @2 Iwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')2 D9 @6 I. F: ~/ T# ~" i$ k! W
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
, z, G2 @# b8 b+ zwrite('</div>')$ ]  E! ^2 m( I" u
}; `* K8 J  V& M
else if (document.layers){
9 S' D. k* R8 ^9 r3 Z7 H- w8 Gwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
' c7 ~4 `  G, V; Ewrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')8 b" u# r* ^3 J/ V! g( i- g: F
write('</ilayer>')
/ E3 G. D: L' y' i1 J. A7 S}7 T" z1 H5 d& s# n1 d" d+ Y  E
document.write('</td></table>')
3 a! f2 a% c. L& T; X4 h3 [}+ P" u1 |1 f9 ^- ~- p, M, D
}
3 u) a4 @4 w; Y- W+ f" T</script>

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