返回列表 发帖

网页之跑马灯文字特效

//修改宽度* O; ]% j% a3 a6 U1 ~' v/ f
var marqueewidth=3004 R4 L  z9 Y* {: V- W
//高度4 M2 q0 |1 ^2 x( n
var marqueeheight=25
+ H! X& N5 Q! z& s6 R, u% p( }//速度(1-10)
/ I% a* r2 I; a' \9 a& r4 J3 jvar marqueespeed=3/ K% ^  M1 n7 j/ ?
//背景颜色# v* p4 I4 D% H% U
var marqueebgcolor="#FFFFFF"
7 G+ n: J6 d2 f//是否能暂停 (0=no. 1=yes)?4 c0 G9 j3 @# h+ H* c2 d
var pauseit=1
: D8 H7 _+ o! h5 P% d: v1 E' @  {2 j5 Y# X8 C5 \
//修改显示内容
* E( {; D; p, ?var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
5 k( H8 @! x/ v' Q! D) F( X
$ H+ _  {% n- `- P6 l! H8 M0 |
( k3 P& F- v* o3 R5 U////下面不需改变////////////
2 L1 U# E! i' T3 G2 E! f5 j! f+ R) A/ l. ?& E
var copyspeed=marqueespeed
5 P7 Y7 t1 Y5 [3 k& w8 ^5 y+ Tvar pausespeed=(pauseit==0)? copyspeed: 07 T1 f7 f% t, K' y- q2 C1 s2 @8 N2 a; L
var iedom=document.all||document.getElementById0 }9 \( ^  Q" i! k8 M6 E
if (iedom)
! I1 }* F0 X# z: n# ~$ ]/ Adocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')" }. P, c$ Q9 Y
var actualwidth=''3 T8 T) m- m7 P- R3 i
var cross_marquee, ns_marquee7 l$ k' c1 v# P& ]1 y4 T

/ S4 i3 C2 ^% U8 c8 V/ kfunction populate(){
4 f# }- T% f2 I' n' Q) p5 Q) iif (iedom){
  ~7 q5 V6 _8 N9 M% y9 Bcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
. v) I0 S, ]2 p6 k, Kcross_marquee.style.left=marqueewidth+83 @* t4 ^" i: c: r2 W5 B
cross_marquee.innerHTML=marqueecontent4 ^  `5 B. C2 N- g
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
1 ?0 F) L+ c( W0 Q: G}1 i* {* k! ]* e2 l8 v: q3 j
else if (document.layers){/ y% f1 Z8 @/ d2 z
ns_marquee=document.ns_marquee.document.ns_marquee2
2 u- u( R& Z: @$ q5 e! A: H- p# z8 Mns_marquee.left=marqueewidth+82 v) ~) D. e+ f3 u; E
ns_marquee.document.write(marqueecontent)
- g$ k% i# R; p! {& |ns_marquee.document.close()/ d- c/ E; |" l1 B  i: V) R0 _- Q* z
actualwidth=ns_marquee.document.width+ N+ V3 F1 B1 g0 B9 N
}& _1 q4 O3 m/ \* Y, j# N6 K
lefttime=setInterval("scrollmarquee()",20)
% L9 v# S9 o$ m+ u}7 Y6 b: J, J8 {0 d5 G- U# e
window.onload=populate
. L) |7 ~5 }7 t, u
; h6 ]8 D  x9 o; `# C5 Vfunction scrollmarquee(){
3 D2 W- F0 G+ b. D% |9 [& aif (iedom){
6 Q9 ^& r4 {3 j$ t/ _5 i/ Qif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
: b) Z1 q1 R9 K2 E* R& S" tcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed9 J7 z7 _" h! q: V: d$ C1 h
else0 V% X0 J  O: F
cross_marquee.style.left=marqueewidth+8
$ a, S1 G" y( I7 M; {
) F; G! c# O+ r8 h}
$ i" f  f$ Y5 u% {8 f: M4 G( q- Welse if (document.layers){
* ~: j/ W) l' w& q+ `4 p: Yif (ns_marquee.left>(actualwidth*(-1)+8))8 Z' F4 P% W/ ?. u: }
ns_marquee.left-=copyspeed% N( f' U# s4 A/ y. i3 r0 |
else/ B+ o- b; N& N. y* j% J: v
ns_marquee.left=marqueewidth+8
# l# ]2 Z% i7 o5 S) }}7 b( U3 X/ m% p! @! T
}. i4 P( a2 @2 f# g& m! T
5 B$ Q! {, f$ G. t( x' k  A
if (iedom||document.layers){
/ f- ]1 q5 k1 h" u4 B0 a. O. Dwith (document){) v* R) r1 Y5 a" J) [
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')# R9 g" p: k5 P8 G& t5 C- E% j- }: R
if (iedom){6 U3 ~8 q% |2 L  H6 [
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')! ]2 B, U( h$ c' ^& ]# W7 x
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
3 a4 F4 ^0 e* v! u0 l7 d' C; Fwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'): c" e& r% I2 U" s! t6 l
write('</div>')$ Q) x0 @4 s; a) f
}8 r0 c; g* z: w4 L( {  R# w1 T
else if (document.layers){
* s, j4 G! h; v1 x6 n& F. V8 O+ }write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
( C: s7 T* ]. u, l; x0 Rwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'), u; V# L' C/ p9 v0 i
write('</ilayer>')' `5 e' g  N4 }, q, ^! Y: V
}
. a, P- h: v0 A. b, `( jdocument.write('</td></table>')# v: A- D' R* B+ ]+ V  T
}1 |2 x& X; U2 b- I# z, z, X7 c2 H
}  Q2 _1 P% @6 [% X0 n, x) m. M/ P& B. c/ }
</script>

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