|
  
- UID
- 133
- 帖子
- 51
- 精华
- 1
- 积分
- 186
- 金币
- 55
- 威望
- 2
- 贡献
- 0

|
网页之跑马灯文字特效
//修改宽度
! p9 P9 v" ? L4 `$ t' a! ovar marqueewidth=300
8 U8 c. u, W3 a8 I R$ m% U, ]//高度3 U; j6 z4 q4 v) d' z$ O7 t6 ?
var marqueeheight=25
2 z. V9 e& V0 g5 `1 s//速度(1-10)
+ g$ r. N0 ^4 b5 G: ?var marqueespeed=3
1 g# D( X# n7 v/ Q* N//背景颜色# U, @* R0 L/ D; u
var marqueebgcolor="#FFFFFF"
9 o: s) Z1 n! e8 x+ |//是否能暂停 (0=no. 1=yes)?
M) ?1 R. |% @& u- Qvar pauseit=1+ g* S/ I, M b1 s0 S3 Y
' v' r! J" u4 w6 g3 V8 T//修改显示内容
, H: q! E. B: U2 ]0 A! L6 G! dvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
) B0 N8 ^6 h; o7 p* ~$ B% \" ^0 i7 u" o# G5 b- s
) w8 D8 R, b1 f: `////下面不需改变////////////
) F- d( j: u+ _, Z1 P1 z5 I3 [$ r
( ~1 A5 X1 S( l/ P! Yvar copyspeed=marqueespeed9 \" m3 e5 I' O5 k g
var pausespeed=(pauseit==0)? copyspeed: 0. V( I1 V% \* [6 G) V+ @
var iedom=document.all||document.getElementById
( T% V# B, P; Z- j# dif (iedom)' ?' ?; l5 u. n5 J! ]4 C* j
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')+ C7 U5 S0 ~0 k" \# k
var actualwidth=''3 P; D- ]* S; c# c" m# P) g
var cross_marquee, ns_marquee
& O# R1 N! y! a$ p9 R/ n
) w3 z; E& P2 W( o' mfunction populate(){7 {: O2 b1 o- [8 M8 @4 i7 Q8 Y6 L7 W) q
if (iedom){ ]$ ~, m+ \! n7 R( |9 o
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
5 y2 K/ _ _$ \6 hcross_marquee.style.left=marqueewidth+8' s/ ^/ c( d. I6 ?$ d& h
cross_marquee.innerHTML=marqueecontent
' R3 A$ Y) W% v& Tactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
$ i, ^# A0 u+ X$ `/ @' m5 J}
- B9 P, P3 S' G' H& A$ G, nelse if (document.layers){. ^& Y/ Y# s2 P. c
ns_marquee=document.ns_marquee.document.ns_marquee2
# P9 ~& v$ k% K4 n" E0 ^% ins_marquee.left=marqueewidth+8
3 G( Z. O; @' I- z* N# _% Y$ ans_marquee.document.write(marqueecontent)) N8 l* }0 s, P; n- c" W7 q
ns_marquee.document.close()
& [: J. o( b N8 {actualwidth=ns_marquee.document.width
# b6 B7 c5 Z: e}
]% x5 R+ `# R! j& ^+ a& \lefttime=setInterval("scrollmarquee()",20)
# N' K9 l4 e, I& E, M}
, o- c" ~+ H4 d; }+ }7 v, a4 i nwindow.onload=populate8 F) j0 y/ e( r, ~- ~2 U' [
5 }2 ~7 A& b! E; N1 p6 j( Q
function scrollmarquee(){
4 l! Q$ s3 }" `* a% g1 R- ?8 ]if (iedom){
) e" M5 p7 Z. G7 ?' R) a* H0 Y+ E: Gif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))3 z: S$ b: K; `' ^# ^
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed* ^3 o1 d3 V: p: m2 J) @& [
else
7 X$ q1 s. a. u$ }% wcross_marquee.style.left=marqueewidth+80 S+ K" N+ v+ q# R. F. ~8 M
2 N' ?( Y( G8 Q. w}
O: |; q2 d4 k1 Y0 A0 N5 B! R! \2 telse if (document.layers){& H8 v8 r- B7 ?0 @% l! B6 Q, \
if (ns_marquee.left>(actualwidth*(-1)+8))0 P R2 z0 n% b; v" m% z8 _! d
ns_marquee.left-=copyspeed& J7 @( T' ^! d$ ?" N! l
else1 f$ `1 |; R& W2 h7 k1 J- n
ns_marquee.left=marqueewidth+8& L/ z: u3 n! k5 r$ o: Q) p: {
} w0 z4 U' k; z9 T4 N% _2 a- s
}' M) N7 e! _" Q% d: R9 T8 ?
3 }8 R r+ B4 D/ @) A
if (iedom||document.layers){+ t n& S% ? l5 u
with (document){
9 a* D( X) v7 n; zdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
9 y1 P% i7 V# L/ A1 H: W) cif (iedom){
% r6 @$ \: e$ V' _1 _2 L# `2 x5 c) Iwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')- e5 I* o4 X$ D4 e5 Q7 M" t
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')6 q4 K1 i* U+ J8 ]
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
6 K, }4 y. W9 Qwrite('</div>')
5 P/ J# M! @/ l" K; Q}, F8 s) ]0 h) Q! r; k% `
else if (document.layers){7 X' X k' R, C& e
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
$ k; L/ T3 D5 a/ J5 A8 ewrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')4 L1 s, L/ X: J2 n$ p7 ~5 F/ m
write('</ilayer>')
0 y9 T4 f$ q8 S, ]}' n1 c" K8 E( Q2 \
document.write('</td></table>')
, @" g L! e: |7 [5 w7 d}
: Y0 r7 S2 ~5 a" P/ H}
8 h L5 d% ]/ T# H3 p& o: R</script> |
|