返回列表 发帖

网页之跑马灯文字特效

//修改宽度1 D( `4 e* g5 U7 o: M
var marqueewidth=300
+ H# U: i0 Y! U- Q. {4 M, T//高度
/ M* T6 y2 P+ i9 N+ {/ G% qvar marqueeheight=25+ h: \* B$ b' S. s/ e1 S% @0 j2 j
//速度(1-10)+ v" j2 x7 Z* T: T5 V# C' |
var marqueespeed=38 @: z8 C4 C$ m0 t* y9 s1 [/ N9 R0 M
//背景颜色. [" p; i4 ]3 p% P
var marqueebgcolor="#FFFFFF"3 Q! O4 n" A0 C' \4 u
//是否能暂停 (0=no. 1=yes)?0 M: z5 w  d7 s8 \& @6 ?
var pauseit=1
/ K$ O' S# T# r4 E* a2 O0 K1 a: N4 K( M- b/ e+ ^
//修改显示内容$ R+ A- C9 q0 _* a/ {# o- D3 G( H
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
+ p8 z: I& l2 ^0 C, Q. ~' b  T  \- J2 a) F: I3 o6 [

8 V5 P5 [. E) Q2 R4 p9 F- R////下面不需改变////////////
8 b3 i( Z: a+ d+ e/ q# k$ A! I% j: Q; k* J$ n/ s" a, Y) [
var copyspeed=marqueespeed
1 J$ [# F4 `1 W' s" svar pausespeed=(pauseit==0)? copyspeed: 0
" \! R* {% V; h, P6 S$ nvar iedom=document.all||document.getElementById2 M( [/ M4 O3 D2 H. Y, M5 X4 P% E& N1 a
if (iedom)1 t/ v! m9 V: i9 C; V$ |
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
% W' j! k$ \! n& l7 v/ ?( svar actualwidth=''
; V1 k. M9 B5 }2 n; {. s, [var cross_marquee, ns_marquee
4 N' S2 f& G6 ^0 Y4 G9 `" @0 ]3 t2 m6 ]( ?
function populate(){) f1 i) o! _8 `6 {5 K1 z3 W2 G
if (iedom){! D) D# a0 Q7 [9 v1 B" s" c
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee) y/ |- \( u3 Z4 T
cross_marquee.style.left=marqueewidth+8% x5 b9 I, e( I5 d$ O5 m
cross_marquee.innerHTML=marqueecontent' G7 ~6 G- l) A' ^" M3 d
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth" t% n- g: H5 `) [0 W* f
}
: N1 P4 G2 `2 k) e% }2 _* J( M8 aelse if (document.layers){  {* ~1 ^2 E4 M+ U( F6 L6 f
ns_marquee=document.ns_marquee.document.ns_marquee2
  A# A8 S( I: Jns_marquee.left=marqueewidth+8
7 }' V8 s; M8 h9 Ins_marquee.document.write(marqueecontent)
' Y- w9 @+ w7 c& Ens_marquee.document.close()* _( \1 r$ ]5 i9 [! C5 f% Q3 ]+ F, z
actualwidth=ns_marquee.document.width
( |& Y6 c" k- E/ V$ T9 w}& u( s, M) Z: j! ?
lefttime=setInterval("scrollmarquee()",20)
) G$ h! }- o9 u) [& I: Q}9 C6 G: C) I" O
window.onload=populate
: D* i* p) e5 g
6 h8 s% d& B1 t# Vfunction scrollmarquee(){
2 L$ d( f4 p; f% _* f' I$ H$ N1 Zif (iedom){: x$ |, Q: j7 u- t: c2 R
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
+ C. a) _+ K; a- dcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
; |: o4 m- J4 ?0 |6 belse
8 ^; C/ S7 s* ?' V  T" `7 Ncross_marquee.style.left=marqueewidth+8; ?+ `" P; f1 I  k; ?

2 _: I( F* e8 _7 U, c, o9 n6 ]}
  o* w2 W5 `; }1 F4 p+ ^3 Gelse if (document.layers){
( {+ {7 j' `) P9 Z3 |3 G  Z& f5 Aif (ns_marquee.left>(actualwidth*(-1)+8))
4 s( ^! g- c: h3 L" pns_marquee.left-=copyspeed! t5 y( ]/ Q4 M/ W8 \
else6 v2 X3 n" v* d. n/ q3 T: D$ g
ns_marquee.left=marqueewidth+8  j/ Q% k9 B$ g5 E
}
1 k: a" R3 i+ c4 Y% ]}
9 f! A( f$ ]" _, o: K% ?1 u& B( T; ^$ {; o
if (iedom||document.layers){' n$ m) U+ Z& }- ?) d
with (document){
8 q2 I) i, V2 y. X; rdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
7 x* {. ]' c& X$ dif (iedom){3 i$ q) W, Z2 j+ e# M
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')& a" o! {/ K+ j3 D% Z
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')4 J) Y6 p8 ^- |1 m% l
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
6 f) X- J0 F4 @write('</div>')
/ }: ]7 T2 w  G- K& p/ X9 B}
7 b+ w( s  c- n- U, D; n  |' J3 Jelse if (document.layers){
- @2 H5 `, v, q! H, |write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')- H4 [. y$ `' c4 S: a+ X
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
3 n! Q+ A5 |- Swrite('</ilayer>')
0 F# r& r7 d* b- r! I2 K, `}
  R3 i1 m' N5 G5 fdocument.write('</td></table>')7 _9 e& T$ D6 G- n2 w
}
( S) E& R( h4 }9 w4 \6 x% i0 B/ U}! n- R5 k; P9 w4 w8 V9 Z1 e( i1 j+ \
</script>

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