返回列表 发帖

网页之跑马灯文字特效

//修改宽度
: A( J3 L( e- T2 b" \, ~# nvar marqueewidth=300' P& y- n, ?. A' {" w
//高度
8 g  |3 f7 b- k6 c+ m. z- V$ C$ Tvar marqueeheight=25
2 a9 B, Z  z( f. g" X8 q4 A//速度(1-10)/ G) v+ l" P/ Z4 W' [3 G  V# Y1 z
var marqueespeed=3
* f% {2 ~2 G( ~! b//背景颜色  M1 \# ^, d; U5 |
var marqueebgcolor="#FFFFFF"' P# f- ^. _. O- _# Z( ^6 v* |
//是否能暂停 (0=no. 1=yes)?* t' }; E/ _  K  X* ~8 f. z
var pauseit=1
( E1 i1 [& r, W% |
; n( n' k2 p$ c7 Y6 p//修改显示内容1 w; J+ X  U& p7 n) p! [7 Z
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
0 D4 K& \/ Y  o( b5 c6 j8 @& r) W! [6 L* N

8 _; y4 v( `+ a& I. _////下面不需改变////////////
! W% ?2 Y* q3 v
5 m6 h' @( k. P1 l8 `var copyspeed=marqueespeed
8 s6 L/ ]2 _' Xvar pausespeed=(pauseit==0)? copyspeed: 0- w! U$ Y, @0 B, G! H
var iedom=document.all||document.getElementById8 l0 Y+ X6 B- F# |2 A' c0 Y
if (iedom)$ e7 P# d& Z8 a( b( @
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
0 t" I! @! F) P6 t! Kvar actualwidth=''
. u7 f2 A/ S# V2 Wvar cross_marquee, ns_marquee
4 p# ?) B1 [- q4 o( L
/ V; X3 s, L) ]; V1 M0 Bfunction populate(){# z7 `$ H( F- R0 Q! a+ m
if (iedom){2 Q6 ]2 ?  x  S6 D/ K9 ]2 \/ ?
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee% g" L! d/ T# S2 U" W2 e
cross_marquee.style.left=marqueewidth+85 p  z, S+ j* N1 a6 c
cross_marquee.innerHTML=marqueecontent
! P* n% e5 z4 t- c7 x' P( qactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
, Z9 ]1 a/ K" Y; P, X}
' @. ?9 U5 U5 `$ w. c$ U$ }else if (document.layers){
; t1 [$ |/ i% R' kns_marquee=document.ns_marquee.document.ns_marquee2
$ W) e* N( u$ k. S7 K% ]' a6 K* ?ns_marquee.left=marqueewidth+87 ^6 v7 L  F- g( c# \! a; R
ns_marquee.document.write(marqueecontent). F) ]9 x; z# ]  [
ns_marquee.document.close()) g. ~$ T  `' p" e: a6 S8 P" c: H$ j! C
actualwidth=ns_marquee.document.width
/ L8 ]6 \! {* M( S# {% K- @4 A$ d}
% |* M9 G: w$ E' k) U+ }9 \lefttime=setInterval("scrollmarquee()",20)
3 b( j6 j# P0 Y}+ E, J, @: t9 p2 g/ g# W
window.onload=populate
- }. R' h: c# _- i( ]& D
5 {& M- r* h$ h4 Nfunction scrollmarquee(){
, m1 U- ?2 }5 \6 d" X& u) V$ ~if (iedom){
% C) |& q1 s4 H3 O8 f; Lif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
7 _" W- e, [1 f; ?5 }3 Ucross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
3 X: S1 K$ B+ l& Y3 welse
- W# r; J8 ~2 g7 r) t0 X* Jcross_marquee.style.left=marqueewidth+8
$ |3 a$ v' i1 A% [) Q1 H  |( \
7 V: m4 r1 Q8 |' i# C' R( M# V9 O8 M! ^}9 ]9 @8 ]/ n2 A# \( a% j
else if (document.layers){  R# ]9 `/ j- h& R/ }
if (ns_marquee.left>(actualwidth*(-1)+8))# C& a" m! I. G1 h% K# u- M* j
ns_marquee.left-=copyspeed9 X" L9 G, Q% o1 y
else- q4 N- D) ^: Z+ w( l
ns_marquee.left=marqueewidth+8
" i/ E5 R2 I" m. B0 S1 ]}
9 E& i; D9 B# D3 A* F# ~5 ?( h" Q* {}
1 w& {/ l5 ?, r
6 x4 l8 b$ [$ U; T! \if (iedom||document.layers){' _/ E" }0 p- n$ s8 ]8 ~
with (document){+ @! k) y, a9 [! T# b
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
& Y" @( Z4 Z2 zif (iedom){
; B4 {5 C/ o, F: Bwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')/ S) {6 i8 q8 p" w+ n
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')% H9 p- O' c8 F. P9 n* l) G, `
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
, q  A5 ?9 }- a1 ?write('</div>'), |0 f! y. |/ M3 l
}% I6 a! B5 x- v  V; x  Z
else if (document.layers){
; V; j' i, g# u- _write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
' c" Y6 |# W# Z8 T; {$ c: hwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
9 e6 i$ I5 p" E( e4 E$ fwrite('</ilayer>')3 [6 ]. I2 d/ d8 `5 F' s3 m9 C+ `
}
# E5 G8 o' p- A9 hdocument.write('</td></table>')
+ D: C& q3 f: N! n' e* y' Y}& j: L9 o: i+ ?( R& a. G1 {: F% b
}4 f4 I3 W4 }% U- k8 N5 a
</script>

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