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

|
网页之跑马灯文字特效
//修改宽度
7 x) F% I0 E% g* L, P0 w2 Lvar marqueewidth=300' L0 {+ l; M0 I
//高度1 K$ I5 H5 H# R
var marqueeheight=25
8 [$ Z& ?/ N' X( g8 H//速度(1-10)
4 T! n0 b5 X- {, R4 p8 Z1 Tvar marqueespeed=3
' l# O- |7 s$ v& l6 G1 F- ]//背景颜色& O* S6 O4 m F' U* ~ z8 M
var marqueebgcolor="#FFFFFF"
! B5 O& B' m& k8 q' N//是否能暂停 (0=no. 1=yes)?, x* |% G/ n1 g. B; u0 H
var pauseit=1 t: W! l8 I* I
, K6 \/ ]% p+ F& ]
//修改显示内容+ x1 y! y/ h1 L2 L! q
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'2 @, `% G* \7 Z q0 f
. \3 v* O# Z& U+ q: \
. m7 ~9 X% q! F1 Z////下面不需改变////////////% I9 m# d' j& `
0 x% r+ c; o) a: J# o, L
var copyspeed=marqueespeed6 \2 E2 ]+ n5 H
var pausespeed=(pauseit==0)? copyspeed: 05 d( o; A9 m0 d; B& |% f+ L
var iedom=document.all||document.getElementById
. G4 t I4 I/ v. w( u; q1 G* uif (iedom)+ I0 E" h8 o3 U; z
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'), H8 q0 X: g# b5 a! h7 m* f
var actualwidth=''7 P0 m x$ _1 A. M) r
var cross_marquee, ns_marquee9 \/ x7 U5 E, n
5 Z& j0 F! v9 M2 ? C! G
function populate(){
' F# {- }9 @1 D, Eif (iedom){
- d" g: S2 _' j9 d# i/ e# Ucross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee' B) B6 I$ V" z9 r0 G) P0 P z
cross_marquee.style.left=marqueewidth+8( ?) k) }4 U2 | v* v) R
cross_marquee.innerHTML=marqueecontent! ]0 R( b, w4 v0 X# `" k: o Z1 S
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
/ K d9 w- A A" e}
; s0 r# q Y& \3 {; p* n8 xelse if (document.layers){
! c: f- Z* {3 m$ t6 lns_marquee=document.ns_marquee.document.ns_marquee2
( {0 K; {+ q8 `" N, M* l5 Z$ Pns_marquee.left=marqueewidth+8
, v. ]$ E2 [' v m$ r- |# F6 Bns_marquee.document.write(marqueecontent)" X2 t/ \. t% S! S
ns_marquee.document.close()9 f" B* N) b' N0 J' i' N
actualwidth=ns_marquee.document.width
2 q9 ?6 P% r* P! _9 h$ p& m$ P i}. O1 O4 [6 q2 d7 ?8 A" b
lefttime=setInterval("scrollmarquee()",20)
% v# `5 D, P" P4 s3 N}( [1 f% ~9 U9 u; X, ~% x9 {
window.onload=populate1 ` N0 u; T/ E$ _+ {/ }
/ y+ W# t' r. H9 \& h0 }
function scrollmarquee(){; G) h$ D1 B/ h# V' c( b
if (iedom){
) u! P2 c3 F+ B1 aif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
6 t0 i9 Z4 q" b5 m+ Ccross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed8 a) \, `1 ^( ?/ z3 g9 `
else+ p! I) _ m0 y
cross_marquee.style.left=marqueewidth+80 z4 L/ h/ c9 s% }3 X: F
: D; a* t& ~ N9 D! T
}
9 B$ @! f8 c2 n' L& b" G8 Felse if (document.layers){
9 e2 s/ O; }- U7 N$ iif (ns_marquee.left>(actualwidth*(-1)+8))! E& d8 n" F1 e* ?8 O1 C
ns_marquee.left-=copyspeed
1 l: L3 U3 i e% ^' F4 {" n! Belse: ]6 x' @9 q. i: \. B6 _! c& U
ns_marquee.left=marqueewidth+89 \/ |! p5 S' B+ J. R+ ], b
}
y0 M8 N8 O7 N4 ?) b}/ L- S6 R: ]3 @) G' n
, j5 k+ {2 y1 d8 M+ u8 qif (iedom||document.layers){0 @& Y0 k. t8 Z' {
with (document){4 y7 ^3 F: _$ @. x7 O
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')4 L& R9 h9 x. z
if (iedom){
$ r c6 p, k0 _) m3 n2 [6 Owrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
8 P$ u' U, S3 r) q8 _! @6 cwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
7 _' |8 K% w# L! ?write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')7 ?5 i! F2 R" A, t6 a
write('</div>')
7 y6 I1 V7 P# j+ v- u2 _}& H/ `9 {: Y% F. o% F- J
else if (document.layers){
- t' w% F4 B. h- X- u) _write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
+ j; _3 V4 N0 b. A) Zwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')% z3 w$ v2 W- B2 k* C# x3 l
write('</ilayer>')1 R( [2 b& }/ k) U
}
# u }- { \# C5 `- k3 U. Jdocument.write('</td></table>')
2 `! a* R3 G! m$ C4 L6 f* d- q}" R/ p/ ?+ D) |8 R. T
}2 K& V) N9 A1 W3 v* s6 R4 x9 u) A \6 J
</script> |
|