返回列表 发帖

网页之跑马灯文字特效

//修改宽度
  W8 ]: I6 E9 I& H( {2 {; x5 T. \* zvar marqueewidth=300
$ r$ o+ X# N% v! J0 u( V//高度$ ?# |: v- ?* p9 ]- X
var marqueeheight=25# u4 y1 u$ a& ?6 E
//速度(1-10)
  M5 T, h9 r" c2 h1 Z8 @var marqueespeed=34 v) `$ B% T" m
//背景颜色6 R& P2 w2 H5 R
var marqueebgcolor="#FFFFFF"
7 f! ]- S- D2 W$ w//是否能暂停 (0=no. 1=yes)?; L# j# o3 q; ]* X
var pauseit=1$ o. N/ Q5 E7 v; N% q& D  n

( u) ]: }/ c; B  u0 j: b//修改显示内容
7 B# F; a9 Q& m  v. r& R: zvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'2 G3 g! H5 }  `6 X) u, a6 F4 c3 J
+ h! i: J- m! ~+ H" E
7 Y5 ?) E, U9 `) m/ G/ D# |
////下面不需改变////////////9 s& P/ R; `$ K! `
" b/ F) c3 O; j! I$ t
var copyspeed=marqueespeed9 K7 ~2 _4 v) }5 s9 M
var pausespeed=(pauseit==0)? copyspeed: 0
$ w3 a6 i6 J6 M( O/ Fvar iedom=document.all||document.getElementById1 F; P1 p& b0 {  C
if (iedom)) A! b8 l6 Y" a6 U5 }* C2 P; i
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'), s+ V, ]$ e0 [
var actualwidth=''& E' g* ~9 m3 g4 E/ F% |$ n
var cross_marquee, ns_marquee8 ?7 C0 F7 ~: Y7 K! I8 u5 C. l- e
- g5 k/ y3 l9 ?4 o
function populate(){
$ ]( {9 U1 }5 Lif (iedom){$ }# u: f/ a( l% B7 h+ V
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
: j5 z6 w+ M# d) i8 G# bcross_marquee.style.left=marqueewidth+8
0 Q! U, W6 n: A) z6 [9 K+ `7 rcross_marquee.innerHTML=marqueecontent6 {  H; ~' p1 o2 N% ]6 c
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
7 D% f& p( z6 }3 _5 ^}
( Z- g" l3 n" b( q/ p9 N$ Uelse if (document.layers){" P9 ?5 P- x: o" f' L  J, v
ns_marquee=document.ns_marquee.document.ns_marquee2
8 X* o/ {# j' N, H) o1 Zns_marquee.left=marqueewidth+8
( y3 n# k- {" o2 e1 L5 D( ]- C8 qns_marquee.document.write(marqueecontent)
; Q% E6 @; t7 A, @2 tns_marquee.document.close()
# D6 {3 Q( m5 q/ l- n4 n1 ?  eactualwidth=ns_marquee.document.width  I! r, h1 f. [& k# z$ n
}
7 R2 L& \$ o: W$ r* e( Z6 w8 B+ Alefttime=setInterval("scrollmarquee()",20)
3 Q! }# t7 d) z4 k& U8 }; X% X}
/ ^# T% A* O$ w8 Dwindow.onload=populate9 R$ |- B9 Z$ C, D

9 ]% E# h" Z5 ?8 Lfunction scrollmarquee(){9 Y' G4 J( Q; J: o
if (iedom){
  D$ Y; ], E, D0 U8 f' d* P5 Uif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
3 X, ]. i- Y& hcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
, {, J2 R! E; _+ x; j: A; _1 pelse8 x0 R6 `* @+ j5 J" i
cross_marquee.style.left=marqueewidth+80 J! t, y) F2 j0 o4 }
0 y0 ?* W+ W0 r- f  d* G
}
* X, A( T1 j, \! welse if (document.layers){$ `5 X, Y4 ~# R+ \5 \( ^
if (ns_marquee.left>(actualwidth*(-1)+8))% d! F1 {7 w+ e/ b/ _
ns_marquee.left-=copyspeed$ B8 e1 L4 w7 {1 v: n& t; ^& F$ z
else1 N3 X! z0 o6 Z
ns_marquee.left=marqueewidth+8
3 U% L/ w% A; @5 M}
1 N% l" F, }% n& l, @/ W' _9 |; `}, ^* d! f6 {  ^! t- h" A

4 X5 X0 C2 r0 \; w+ h. [+ h$ aif (iedom||document.layers){
% r0 H' u8 i# m6 D; A! S4 M% zwith (document){" [- k$ c) ~: D& I& j
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')' P" {+ i% x9 N
if (iedom){
+ e* s" s3 `+ D! P5 W1 W) {write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
8 F$ j3 m) t6 F# gwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')' p9 k" n: L5 k8 N. }8 c& Z4 R, i
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
" h# b$ w7 z4 n4 }1 q2 H9 }6 Iwrite('</div>')
3 L& d$ `6 h* y4 I}
. Q7 ?" ?3 ~! delse if (document.layers){: w. m" ~. |. [0 j; a& S* K
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')9 r: }) l$ e/ B  J. x% ~* i3 c  c
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
" z& |% o9 ]  n! Ywrite('</ilayer>')
- V4 ]1 R# [3 e& `}
4 }5 S; G8 U( |document.write('</td></table>')6 P. a! }. s9 T/ x' H. T/ e: q
}- K5 Z7 X& `& j& D7 @/ s+ }: f
}5 d- w* ]& k8 ^" B" {4 ]
</script>

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