返回列表 发帖

网页之跑马灯文字特效

//修改宽度
, B1 e9 m" w. Svar marqueewidth=300  F. u9 k2 X2 |5 I+ ^2 ]* D. I3 x# }
//高度
7 N9 K- O  j' i) s% Vvar marqueeheight=25" x  _! l- b3 o: R& [5 L
//速度(1-10)
$ t( N- V6 e& f# kvar marqueespeed=3
! o$ z" q& d7 X  s6 J//背景颜色
. f: e5 i9 p  F* B" ]8 cvar marqueebgcolor="#FFFFFF"/ G) W4 `0 b, z  u/ C
//是否能暂停 (0=no. 1=yes)?
0 a# n  q7 n( N9 B) F. I7 @var pauseit=1. b# \2 r' x3 E0 G& a0 B- W9 a( x

( b1 B( v$ a3 z( U% h  R1 @//修改显示内容/ n- q& P  c2 G$ V$ |0 x# w
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'3 r, u4 L8 K- S2 C0 l$ B1 N0 ]
( o( p2 O- f/ L7 h3 r
- ^1 y2 P' a* P3 a: ^9 a
////下面不需改变////////////
! U- ^2 ~+ C. Q. a; L& [
1 r2 |- y1 ?6 }$ G' K( y* Z3 ?var copyspeed=marqueespeed1 {' E9 s' m, G; ]& \7 z
var pausespeed=(pauseit==0)? copyspeed: 0
/ J* z! i! R/ m# gvar iedom=document.all||document.getElementById
$ j. I. z: [3 w  Sif (iedom)
- }* e1 @1 J( C. r+ Fdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')7 p6 P' y/ w$ L
var actualwidth=''3 m2 n0 G4 k8 S! s- U3 H$ b
var cross_marquee, ns_marquee& W: u# [5 n% J: @' A8 i1 d# |
& D6 m! }. H( R" U8 Q7 F, l
function populate(){
/ c. w) H* e$ V# J! [if (iedom){
! z  n7 m0 t/ _cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
5 B( |0 M  W! p, N3 N, ecross_marquee.style.left=marqueewidth+83 i" r5 m5 }9 S: G! E+ V8 v
cross_marquee.innerHTML=marqueecontent  s4 S2 D0 E! [% v# T$ k6 n* l6 x
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth- }4 R$ t+ Z% e, w# L
}- m) {; x2 H/ m6 d" b
else if (document.layers){
* j; Y  U: D! N( Bns_marquee=document.ns_marquee.document.ns_marquee2( c1 m5 E& ^3 d  b7 U/ g
ns_marquee.left=marqueewidth+82 p- S" c6 C- u# X+ N. [
ns_marquee.document.write(marqueecontent)
0 F9 ]$ [; S/ Y# H5 ?ns_marquee.document.close()
% D0 t8 K. |- F3 @. b/ vactualwidth=ns_marquee.document.width
* U$ p9 [3 ~1 P  @' J8 }/ ~}
% ~& H5 w2 p& ?4 P* `lefttime=setInterval("scrollmarquee()",20)
1 {- o! n4 y$ `, Y}
# j, g& R+ w/ b+ `window.onload=populate9 f3 l$ k( r; j$ q. m# Z

7 ~% B+ R5 |% @/ e7 Dfunction scrollmarquee(){) I7 t/ m- T* t$ T
if (iedom){1 L3 b$ A) `5 e
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))# R, i% {2 w7 w: M
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
! `1 R- h5 u. K, M+ p( \else: `) ]. t; G! c$ D5 F$ P6 T4 B3 ^
cross_marquee.style.left=marqueewidth+8
1 A$ E5 i+ C( I$ F. Z  Q- L0 ~. D! j9 d: J0 B: p- R
}
; @# z; g$ X5 J( P* |: n% a2 Relse if (document.layers){
3 S: s9 [* @. Z' d  D/ w4 Qif (ns_marquee.left>(actualwidth*(-1)+8))
7 U  }' R  S# r* w- R8 hns_marquee.left-=copyspeed6 B: E  p* L8 V& h% Q3 d" }0 {0 i
else0 j# m) T$ V9 H7 Q1 [
ns_marquee.left=marqueewidth+8
' Q3 n% x0 C5 o+ B+ Y. ~}/ `: D2 [9 k9 ?  @
}
  R# j/ }/ q2 Z) G6 x% d/ n  o! x
# v: j( I6 i$ v4 y; d& B. eif (iedom||document.layers){, N' s$ Y+ f% ]& e4 d( m
with (document){8 E) j4 c" q) |4 n7 Q$ k
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
" ]2 K0 @2 Y3 Oif (iedom){1 Q# W1 Q' G: p
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
& t3 f8 j, g9 Q* Lwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')$ s9 \1 c* W8 Z$ i" a2 X& y& _
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
* X0 G- G; f0 T& b2 Gwrite('</div>')
2 f/ R! b1 _+ G" z: Q: w}3 x1 _+ p# z, x; e; s7 `
else if (document.layers){  R) K! n; f3 k: U
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
! n1 q" v, o2 }* c& G4 kwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
! W0 }" B- v" @% Twrite('</ilayer>')
, {8 x7 G4 e6 e6 m4 t  j}
* M5 s6 K( C8 Q6 z1 Rdocument.write('</td></table>')# R8 k6 _" o; o$ _
}! D  J* l7 T/ x9 ?
}7 f& O  W* I+ p+ P3 w
</script>

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