返回列表 发帖

网页之跑马灯文字特效

//修改宽度
; p+ a2 Y3 V5 Y4 Kvar marqueewidth=3006 p: Q- f1 H9 Z  G# E5 Y  X0 ^
//高度
3 l7 q% c# I5 s/ R6 O' v* g) svar marqueeheight=25- N/ }4 [; I$ z2 z% x" g
//速度(1-10)! d; K. E% M, X% x* p1 D$ `2 n0 F
var marqueespeed=3
" U1 N9 E  p( o//背景颜色
( b# k1 a  U; A9 W+ a+ T4 U' svar marqueebgcolor="#FFFFFF"
: D) j7 }/ Z$ H* X- |//是否能暂停 (0=no. 1=yes)?
2 d/ J6 o" o( k1 c$ pvar pauseit=1
7 ?6 t. ~, U# H  {& W  @" O) A: c$ G8 S, i' F
//修改显示内容
, N  k8 P9 I8 u  L2 k6 w9 ivar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'9 Z  U" O& o9 j. F
" x. l( Q5 n5 S) c
* \! b$ T3 k7 K2 Z; z" {8 f
////下面不需改变////////////
2 f* y, o% f- A) z# {  @  ^% R$ @! b
var copyspeed=marqueespeed, M6 o) H; H, m+ e
var pausespeed=(pauseit==0)? copyspeed: 0/ _5 @7 }$ ]+ Y. x0 s8 u( @: s
var iedom=document.all||document.getElementById" h3 c- m0 r) ~
if (iedom)% A$ e+ A5 J& ?$ |4 r1 @
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')0 w7 I" ^$ G7 _
var actualwidth=''2 z' O% a. }0 K" J' Y3 n
var cross_marquee, ns_marquee
: H- \! p# ^; d6 U5 v4 Z6 r; t6 L3 L) L4 j( W8 i; q
function populate(){
. J( ^# Q5 |$ u' l$ A0 @if (iedom){
; F; C- y! U" @. Y! |; i  [cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
2 J. Z, g# `) f+ scross_marquee.style.left=marqueewidth+8
4 N5 d1 Y3 a5 Z( ~  @* g  lcross_marquee.innerHTML=marqueecontent
& f# l0 D0 ?# D* |! i1 g) Oactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
2 O& `, s; l( \2 E: J}
: h. w2 b, ~- k; y, d: felse if (document.layers){
4 Q" d" j% }0 @$ Nns_marquee=document.ns_marquee.document.ns_marquee2
; n2 ^& ~2 `) W! E0 [: D4 ]9 `ns_marquee.left=marqueewidth+8
$ ^4 e2 u5 v1 D- Zns_marquee.document.write(marqueecontent)% v7 J! w, n% D$ C% G
ns_marquee.document.close()
# v* o8 W' n; w) lactualwidth=ns_marquee.document.width
( S+ `; z) o2 S3 O/ W& P# V. Q! M}
9 n3 A( z4 S  b8 llefttime=setInterval("scrollmarquee()",20)
4 J3 |2 m' n# u}
+ R4 e! ~0 B  T/ Rwindow.onload=populate
" w) S' U+ E0 O9 ^4 j
0 ~+ b; @( n+ S4 N7 P6 O' Gfunction scrollmarquee(){
* m# V4 A" D. g. [7 l9 uif (iedom){
, X8 B; K8 h2 K; z& Wif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
" J- S5 K- L% O6 `5 \" L7 N7 hcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
4 U8 Z  y, Y( o  Welse; Z, l% \# c/ N
cross_marquee.style.left=marqueewidth+8
# |* {9 w9 a. u5 a8 a# r5 y( I4 L. o7 y
}
9 ?3 T7 j. n7 ^, n6 Nelse if (document.layers){
; [4 L, B1 X" y& Zif (ns_marquee.left>(actualwidth*(-1)+8))2 v( Z8 s, c, a( I! Q' c# B
ns_marquee.left-=copyspeed4 Y# s4 R/ d3 C9 Q2 }
else
. T& L4 c. E. r8 t0 a2 qns_marquee.left=marqueewidth+87 Q" B* J! y  [: l. B8 w" W1 q
}
2 J% G" d4 k! A0 ?& R. c/ }- E0 D}
. h/ x% d' E2 d; |# U4 @5 n$ x( F8 }/ U* Z% |
if (iedom||document.layers){
8 O+ T: h' b& w* _) ywith (document){
8 }7 B4 H' r- h- _document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
9 X9 j' ?+ ^  A+ P( _6 Hif (iedom){
; d7 N, Z0 q& w# p$ w5 lwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
8 q' M; L, ?" K% awrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
* x# T  \& e! q# N/ u0 r* c8 D, Ywrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
: Q6 G# x6 \9 j0 Zwrite('</div>')
" K% \7 y, L! w}) m1 ]: N, |9 y
else if (document.layers){
; \5 c! q: K% K8 cwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
: [" W8 z+ Q' l, u9 G& Fwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')- w! ^( `9 S5 z, Q3 C+ U: h
write('</ilayer>')
% v, s; S+ T6 A/ k. j8 T3 G- K}
' |8 i' ]# i9 I" ]( zdocument.write('</td></table>')& ?- B1 w/ T  s! k" k! y
}
- _3 e% X5 U9 R+ }$ t7 Q: J  u}- k4 S1 L) h. d6 C3 k
</script>

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