返回列表 发帖

网页之跑马灯文字特效

//修改宽度
* D2 e' ]3 e* g4 Ovar marqueewidth=300
) w6 v: m) Z: O; y" s( h//高度; A, I) ^5 K7 @3 S. ~
var marqueeheight=25
0 B1 L7 `" O+ Q, ~: E//速度(1-10). E3 G- W9 A+ {
var marqueespeed=3
1 |, c- l# ?8 I//背景颜色" l+ p; x2 K# l' b6 e: m
var marqueebgcolor="#FFFFFF"% u' E- `$ C- y2 X' M$ |6 L
//是否能暂停 (0=no. 1=yes)?" K1 K1 W; b3 C& x
var pauseit=1
: x, h* s4 j: i- ~# R
7 _! y. `' V* o9 m4 p- u//修改显示内容
3 V  E; ?* f# x" {var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'3 Y" z- R( \$ G5 ?2 F2 E" @
4 S5 X* G) k- y) Z. O0 a7 L

" D$ s3 X* P/ f7 V% I////下面不需改变////////////
8 l+ M4 H) G) d) K! g: t& I4 d; J! L5 Q
var copyspeed=marqueespeed
1 m' Y* v6 X) K  }% f6 P( Nvar pausespeed=(pauseit==0)? copyspeed: 0! H0 Q' N' |3 w9 k+ f2 Z
var iedom=document.all||document.getElementById
0 e6 Z, M% b, z9 Cif (iedom)
+ ]/ N. c6 v) `* x  b$ D3 Ydocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
2 o  a9 y0 A$ A  J% Pvar actualwidth=''5 Z+ `2 Y6 M$ Q  D
var cross_marquee, ns_marquee
) r2 Q& H' O9 Q/ f1 N# K! E/ H& J. X2 k3 v" G
function populate(){
" ~$ [# e, i. Wif (iedom){
- G2 T- n5 r2 k& h1 d$ I% L+ E' `cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
# R3 I7 n+ e- N( @, }  fcross_marquee.style.left=marqueewidth+8
( a& s9 w( E1 K: }% p' n4 fcross_marquee.innerHTML=marqueecontent
- O" F8 ?$ _: y8 D: _) K6 Mactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
% V2 H; C: c0 F}
+ W4 z+ v+ G4 U1 N6 ]' Felse if (document.layers){
4 u* ^! m- B' a1 j: e, F  Z* ^ns_marquee=document.ns_marquee.document.ns_marquee2
6 @- \* I: S8 C! ?2 Yns_marquee.left=marqueewidth+8( ]$ U& v) r- q/ t7 T  r2 o. x
ns_marquee.document.write(marqueecontent)* t7 k3 [" z4 H: ]- k
ns_marquee.document.close()
7 ~6 \1 z6 |( s$ d/ eactualwidth=ns_marquee.document.width
9 `- P- v$ R/ D6 r}" O1 k; m+ n3 u
lefttime=setInterval("scrollmarquee()",20)' E0 m: b" T( g4 K( J) A
}% b4 l1 m8 Q0 @' Y: t) W
window.onload=populate& p6 x3 j. p( Z$ p
7 p' [; F" S+ L8 y
function scrollmarquee(){
( Q$ e8 {: ^! i- R( @if (iedom){3 S1 \( D* T) d" f8 V, y
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))( e: G; d: ^& u0 X4 [
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
4 w, K& y: ^. ?+ G& oelse2 L$ r: J6 Y) }! L# e1 u- Z
cross_marquee.style.left=marqueewidth+8; w3 r2 I: ?% h: X  o5 H& e+ V

  @6 h$ B0 L% I5 p9 U, l; e}9 A! I+ E% c: ~- h
else if (document.layers){
" t0 g9 \; u# zif (ns_marquee.left>(actualwidth*(-1)+8))
5 d; m' a2 J  [: y( Uns_marquee.left-=copyspeed
2 v# @/ B2 V$ {6 d. L2 E. welse
9 x. B# r. j. Q# ~6 W8 Yns_marquee.left=marqueewidth+8
2 ^; p4 Q! E) t) J  k% ]& s4 \" i}* {, _8 {- V1 H( N" q
}
) o7 ~" f* }" V! b9 {
% o8 ~; v7 m. m2 O4 f! `if (iedom||document.layers){
9 W0 q5 g& X% ]- `' O9 U6 S+ }; Zwith (document){
# m* I  o% S9 b" T& ]document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
1 m1 Z5 \/ C: Vif (iedom){
2 K) T2 T! Y0 lwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
: s, }  I. K: dwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')3 u" ^$ J) ~4 w: k, }
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'). _6 c" ^- g9 J" J! A9 m% Z2 ?
write('</div>')8 i5 q/ \' e* U
}
5 l. o% b8 f9 H& R. Y8 F8 K. relse if (document.layers){
7 ?# u5 ]/ M( L. H9 S" ^write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
: S5 f! u% c( K: c. e" ewrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
; a5 Q/ Y+ U8 \" e. n2 fwrite('</ilayer>')3 q. v" N& \1 g2 _, _) d3 D5 d
}
( Z4 y0 w# T& C" Zdocument.write('</td></table>')
: h* s* ?# `. D8 A. e, D% v}
: B# U* I. y( {$ J. r0 F}0 @" H3 h( O2 V' m+ A  }+ _
</script>

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