返回列表 发帖

网页之跑马灯文字特效

//修改宽度
+ u7 A4 x% i4 }2 svar marqueewidth=300
+ f3 m/ f# K6 y/ x& B& @( a; p//高度
) V# u/ B, K4 ]6 s) e3 mvar marqueeheight=25
( ^  N$ D7 M0 w& y//速度(1-10)
+ k/ Z. a  M# n6 \4 @5 yvar marqueespeed=3
0 D0 I+ O7 p# ]# n; K//背景颜色# v$ }7 u, Z# _( ~
var marqueebgcolor="#FFFFFF"+ U! v' J" u' s2 @& u6 z
//是否能暂停 (0=no. 1=yes)?
, C& `) U/ `8 Q2 `7 S5 _var pauseit=1
6 ]/ r4 P1 B$ Z7 m7 V( O2 V" T# i6 `' V
//修改显示内容; P) M7 n; e- J! M+ m
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
8 r2 v6 G8 l' o2 L$ f. z- J- h1 f

7 w; H1 V2 S" C: L- g////下面不需改变////////////! L' M  G* u5 d. X" _
; {( ]6 z1 x' E* V
var copyspeed=marqueespeed
8 A; z; {) Q8 ?5 Vvar pausespeed=(pauseit==0)? copyspeed: 0
6 Z0 ^. h1 e/ }! G$ K: Mvar iedom=document.all||document.getElementById; f; `" P  B3 C# M0 i9 {
if (iedom)
5 l/ r0 @$ K" j" [, W- Edocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
$ k2 Z0 K0 Q( G; Avar actualwidth=''
' m3 H! e9 k5 j$ D' i0 e/ I* Qvar cross_marquee, ns_marquee1 L7 Z4 h8 l& V/ ^
$ Z+ S* w; |* T( d
function populate(){/ J; k& q! g% N" h2 y- a- K6 [
if (iedom){
$ G7 j% p# J+ Z! r6 ^cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
6 p* v1 h' L/ c# Mcross_marquee.style.left=marqueewidth+8. U, `8 C9 M2 {% r
cross_marquee.innerHTML=marqueecontent
; n2 j8 D! R, G+ U( ]3 {3 nactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
, v6 R' C7 U1 g* s& Q, x& J# A}
3 w. T! g5 n- zelse if (document.layers){
. {7 n% T0 v4 G8 D! {: g6 m: _ns_marquee=document.ns_marquee.document.ns_marquee2
  F$ e5 d- O% Y0 z9 Fns_marquee.left=marqueewidth+8/ {. v" y% P) B5 y6 k4 R
ns_marquee.document.write(marqueecontent)# T# t3 Y) V& m) W: L
ns_marquee.document.close()
/ J% _. b$ b+ p, n" iactualwidth=ns_marquee.document.width# {# p" {4 \' c& W
}
, Y0 E9 N) ^+ z4 F. R" ?6 k2 Rlefttime=setInterval("scrollmarquee()",20)
! H. u% E9 ^; P" e}9 F* b4 [+ Z( V6 ^- |( G
window.onload=populate5 _% u2 k) F( J+ P# D8 |
/ ]9 V! v& q8 |4 p9 {$ C  A
function scrollmarquee(){
% Y; q7 }7 u( W  ]$ f$ Tif (iedom){
8 m; G( }4 G$ F8 P* Y5 Aif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))8 f# B* N9 W6 [! v
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed& F0 B* H: Q6 P  g* U
else8 m6 p4 B+ o  ]3 j
cross_marquee.style.left=marqueewidth+81 ?2 X9 C& G. k0 q( E0 R
8 F5 j7 P# Z/ W+ V, w9 B
}
. @8 }2 |7 W: H5 G  f! Relse if (document.layers){
+ G! j" J- v6 w; q& U* |% Qif (ns_marquee.left>(actualwidth*(-1)+8))9 c+ @! ^6 @; C; S& \* p! d9 W
ns_marquee.left-=copyspeed
5 j7 `9 F& v* oelse9 o* x- o9 t$ c: J7 \
ns_marquee.left=marqueewidth+8
  u$ Q; h. e) b, H- ?: t* U/ S+ v}
" o/ b# a; M* V- V1 n$ k: ?}
; s: u. Q# `) n
- z- z6 A: h& Q3 I3 B4 Uif (iedom||document.layers){
% l0 |: G5 D  }9 cwith (document){
8 S1 x: t. r6 b. k3 }5 x6 hdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
) G. i3 Z* z5 e+ Q! D& \, F! Zif (iedom){, i: |1 s1 d8 S+ ^5 i3 O
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')2 X3 y; _8 k7 [! M& {# u3 S& G
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')+ N% j  _2 V+ m( S- Y$ U
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
+ r& K8 J% o% Z. l' N" H0 {" }write('</div>')
, T9 g6 ^) K, q* a  v}# z- T' M8 J; F8 c( S% x
else if (document.layers){
/ P' y! D. L2 dwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')) _8 u6 ~! p. x7 ~3 {
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')8 _. k* o$ \) k
write('</ilayer>')/ t$ L' k: H$ a( B
}
2 D7 D* ^* C" S- zdocument.write('</td></table>')
% b& t0 N8 C  ^( G8 e}3 f' @4 ]; b' F) @
}
' W6 a" \. U6 t7 H% T. b" O</script>

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