返回列表 发帖

网页之跑马灯文字特效

//修改宽度" G5 y) I+ m, z( ?' c
var marqueewidth=300
3 h# j! b0 j" ~8 ^/ I- `" g& a! {" l  ^//高度
/ x/ k8 ^9 `+ j" e- wvar marqueeheight=25' m! ^$ I% A9 e9 ^& C5 _
//速度(1-10). v# V+ H) x$ n( G& T1 Z8 l6 T3 V* ~
var marqueespeed=33 S# ], p' h5 V8 ]8 V4 j- c
//背景颜色) }! e& H) a& d
var marqueebgcolor="#FFFFFF"
. W, E5 T7 m9 }. P/ d3 M//是否能暂停 (0=no. 1=yes)?" }0 p; M( |$ F& ?2 K8 ~: Q
var pauseit=1
/ P$ Q* f) |# f' q( e2 e. s- n; Q  F% B. Q4 s' ]2 ^8 Z1 ?3 B
//修改显示内容
8 u% w" |( H% h. i& V# ^var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
3 f" Q" M* n) J1 R. h: U$ a1 q& N/ A# J

0 Q0 y' e" ]7 {* s. f7 B/ j& c////下面不需改变////////////
% j; {" _7 `5 u+ q! `: _: P7 o& V5 j+ @3 I# [' w; s' a
var copyspeed=marqueespeed* T2 j% |* a( P8 h5 K8 _
var pausespeed=(pauseit==0)? copyspeed: 04 t( h' P6 I& R# P9 R
var iedom=document.all||document.getElementById
- V8 }7 p; B1 v9 p8 R4 T$ r: Jif (iedom)
# T2 {2 g5 t# c  s/ adocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
- U3 p$ D+ z# w; C. s7 Z" Y9 B/ lvar actualwidth=''8 P2 e: R( M/ f! c: G
var cross_marquee, ns_marquee
+ v* B; l  O) E& h) F
2 s$ [$ b7 R: M/ v3 kfunction populate(){) k; ]: p  M, G0 F
if (iedom){) N  u) U7 n2 E( |5 @, D1 d
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
$ i# N9 q0 H# P) _6 R* M7 B' o- Z/ jcross_marquee.style.left=marqueewidth+80 C! p+ j2 }0 O/ a
cross_marquee.innerHTML=marqueecontent
' z, y$ U! e8 [2 B$ Zactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth! w  {2 G" f) Y( o3 U
}
6 ^/ t' K+ h6 M' Melse if (document.layers){
$ y7 W; H2 M8 qns_marquee=document.ns_marquee.document.ns_marquee2# d5 K8 c) Y; U' |/ }0 N9 e% {
ns_marquee.left=marqueewidth+8
% H2 ?5 U+ I& T, Ins_marquee.document.write(marqueecontent)1 q% X5 A- N0 |
ns_marquee.document.close()
" G* O; m" [* i7 j% h2 Oactualwidth=ns_marquee.document.width
% t9 v: }- k" [# }7 L}
  k# K! d' J% l* L7 F# s5 y! u7 alefttime=setInterval("scrollmarquee()",20)& c, `0 D. o1 H8 b" Q  h: C5 l
}
- m* l$ `  t8 a+ m) Dwindow.onload=populate
; ?3 V: i! L3 l; A% {+ F/ `) [$ `5 \8 G7 m& q5 l$ [& _
function scrollmarquee(){( I+ [  G# a' [' b
if (iedom){+ z2 i7 {0 \$ {* E+ p* g$ ~
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))% }" |9 R% j# O# L7 j& m
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
- W9 o) e8 h" X; |2 m7 selse$ x/ ]5 t( ]# `) t1 S6 S
cross_marquee.style.left=marqueewidth+8
' T; q0 {5 y. N7 _9 C4 B( q4 h
3 F: N$ L1 H6 H" F' C3 K}
* g: O5 g) n! @# {else if (document.layers){
7 L# D2 w8 B6 P/ k1 x# xif (ns_marquee.left>(actualwidth*(-1)+8))( ]( ]$ o5 o' o  r$ D+ W6 n: X
ns_marquee.left-=copyspeed9 m) t; U+ C2 s
else6 r1 b* p$ N* x; J* w
ns_marquee.left=marqueewidth+8
6 c1 |% E9 I# C3 D' u7 V! A}
- C) h( z" P% U: m2 }) {}, f9 m8 F  S8 u1 v7 ^

/ r  R6 L+ A4 ^6 \, Vif (iedom||document.layers){
7 s% s+ h8 E, c" O" O( Mwith (document){
1 U% o1 r  e: O% _! U3 B, C& I+ q/ udocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
& ?: K/ W) Y5 X, O8 z3 I8 M6 j( ~if (iedom){
% C& f8 p  ?) h3 ewrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')+ ]" u/ W, W! }/ f
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
- _4 i9 U1 E8 d2 h. j  G+ \7 D# rwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')6 B+ w, H% b  l1 i; E
write('</div>')
1 ^+ T( ^& v- B; Z: U}" |  R9 F6 z  V( d6 U: j) q# k" T$ Q- a& D
else if (document.layers){
$ M& F- }+ N! X5 X  K( qwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
1 P" o) C$ n& f' c. ^4 X" ewrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
8 t$ _4 j/ M5 q( V" v# s6 Pwrite('</ilayer>'). C- S* Y( M5 }$ j' h* Q4 ?
}
3 G2 w8 u/ d2 C6 z6 _, ~' ldocument.write('</td></table>')
; R$ d/ ~8 n+ u2 U/ Y3 p# M}
# d2 T+ w$ ^2 D6 ^7 X( S- [}" B8 ~! W# X5 V3 t
</script>

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