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

|
网页之跑马灯文字特效
//修改宽度
8 W& a) h5 B) }) b* W$ ^& H3 w; L9 s2 lvar marqueewidth=300
8 r8 d( t; b& n# N- ~$ C% v//高度
$ o7 W* e6 v$ H! V' f; [var marqueeheight=25
: P% |7 O2 ]& e; e/ [* [) a//速度(1-10)
9 _$ B& P' s1 U9 e7 F5 Wvar marqueespeed=3
2 n6 a" W9 _# g5 [, i# a2 C//背景颜色* Z' ~7 G9 z; C0 j0 H
var marqueebgcolor="#FFFFFF"; ]9 C8 \# ~% R; a( [
//是否能暂停 (0=no. 1=yes)?
. O, H0 Q+ g- y: I- ]var pauseit=1% W/ G5 t; P0 i# l7 J5 X
6 E# S7 K: j: S+ c) S
//修改显示内容
# {/ c! N$ y( o7 bvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'2 C# c$ I6 ]. s( c3 a
/ u$ t0 f8 e$ A% T; I
' H+ q2 Z& p7 H! f2 S
////下面不需改变////////////
$ ~: z' o& W& m
; n" k+ ~$ B; s# b7 q4 Rvar copyspeed=marqueespeed
4 _' I$ w$ ]$ ]2 qvar pausespeed=(pauseit==0)? copyspeed: 07 A. e9 y) R) d. N* O+ Y7 ^0 }/ L
var iedom=document.all||document.getElementById
( b' V8 i! }! Y2 tif (iedom)6 q* V! a1 ^8 u6 N
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')% ~* c" ]+ }# ]* {2 f. a
var actualwidth=''; F/ T7 }3 c) @) ~
var cross_marquee, ns_marquee4 e+ c3 d/ @1 o6 g1 @9 y \
, Q8 Q, X$ r: L# m
function populate(){
( {; J" D# ~3 m& K/ x) J; J$ Pif (iedom){
6 q6 Y D/ [: B# kcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee; [! V9 C! Q3 ^$ v
cross_marquee.style.left=marqueewidth+8) F7 c& o3 N8 f- G& |3 I. S
cross_marquee.innerHTML=marqueecontent5 X4 |5 f$ W2 j- M4 e- A3 P! W
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth- }2 Q# H' S9 D
}1 E A) r1 s, F( f; I5 l3 }- w. t# R
else if (document.layers){1 e' O3 t3 z, c5 `8 K
ns_marquee=document.ns_marquee.document.ns_marquee2
, E3 s% k4 v8 Q4 \" f( jns_marquee.left=marqueewidth+8# F) A* ^9 h5 f- b; l$ m* g
ns_marquee.document.write(marqueecontent)
. R" H- O* R- W; R8 K6 Ans_marquee.document.close()) v6 W) p5 R: R: g, [/ u; [% N
actualwidth=ns_marquee.document.width
3 D5 |; P7 Y$ i9 f}
% U1 D) I7 l" O C# I* A% Y! Llefttime=setInterval("scrollmarquee()",20)
) T2 z/ U. `& O& |}( ^5 P& ^! Z8 C, y) m& @4 g
window.onload=populate- N4 A. b* m. ?, z) }
3 C8 a" @; r( E5 E
function scrollmarquee(){
; V( b$ E; y6 D7 W5 rif (iedom){% a# i+ m, n" c# A
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))7 W) {9 Z8 W" f, L
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed6 i4 E$ C6 T+ T7 s8 ~$ B
else$ `8 g0 v6 z" a, J1 f* K
cross_marquee.style.left=marqueewidth+89 Q. F) V) n* k6 B6 B
8 P. ]6 z* f. J% l) d: B" O}
+ s2 E0 k' }$ ^( ]/ @. Yelse if (document.layers){0 S) N) S& b$ X$ S1 u9 Y$ v
if (ns_marquee.left>(actualwidth*(-1)+8))
1 f$ \* W r s* B, _6 @, G# j/ Cns_marquee.left-=copyspeed
; `& l* W! Z3 T$ i6 S5 G; {$ o Yelse
. o+ C, w& f7 Tns_marquee.left=marqueewidth+8
( N4 |4 }0 d3 t}9 p( ~% k) _: w2 B- |# \$ T
}
& K9 {9 u" A" B# B3 E F9 A i6 G5 W8 Z$ T
if (iedom||document.layers){1 a' B; o, N9 L" v3 r" A
with (document){1 M) H- V# t6 k. [5 U) G
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>'); ~ e% ~' M8 G' `
if (iedom){
/ \ Q+ n0 v+ h0 X4 \) vwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
# n1 K; M5 I7 I. f: B1 j% pwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')2 _: E! F1 {# d& l. {/ A5 @
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
" r$ T' K2 G6 Z3 o4 Z7 awrite('</div>')
^* H5 P9 n( c0 @4 v- r. y, E}' t/ Z( w# I* d& y& y. W
else if (document.layers){+ R' P Y' L) v [6 L0 [
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
) @, @6 u& s" z3 O1 r! w9 wwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')5 |3 ^: O) u9 |+ \4 u0 Z! }- n) E
write('</ilayer>')
( V2 |1 J w) o8 k$ {- n) U& K% g}
$ c4 B @5 s& ~- h6 d9 M" b; Ndocument.write('</td></table>')( N* K2 T/ X* }4 P" G
}6 N9 x x& w8 e5 B4 R6 b; a
}; u# z e. G3 G! k& Y' X% ?
</script> |
|