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

|
网页之跑马灯文字特效
//修改宽度
6 |& h$ s9 f1 Vvar marqueewidth=3000 W( l0 M# f3 m$ i
//高度5 z- s/ Z1 s2 Z9 Y6 I. a& S
var marqueeheight=252 N* W$ Y: E3 r6 @2 A! P
//速度(1-10)
4 g0 K8 s- Y) R% m: \var marqueespeed=3
2 ]( i0 W5 A) [% {" b//背景颜色
. E5 D" K2 o& Q4 cvar marqueebgcolor="#FFFFFF"
; P7 k% C6 X6 B# b//是否能暂停 (0=no. 1=yes)?
2 L5 \+ |2 n6 Z- { `var pauseit=1
# t* Q! {- C4 Z- j6 x* K) [
) `+ p f! k8 O0 a% ]" l//修改显示内容
- J" D% B; U' S$ w6 O5 E# Zvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
Q$ S- W) x3 _6 S9 l C
8 v( R; ?4 y4 l0 {. e8 ?' ]
: C+ c8 R# @8 V////下面不需改变////////////9 R. c h# Q: Q% z6 c( ~+ ^$ ^
6 \3 P$ p8 r' @! Y
var copyspeed=marqueespeed$ V9 e% t, D i
var pausespeed=(pauseit==0)? copyspeed: 0% G1 J# p2 T" z7 u0 P
var iedom=document.all||document.getElementById. d+ D/ M% D! [/ B
if (iedom)/ @$ @* W! d* \" `. g" s* g
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
1 Y9 c( r4 a# d7 t" r. Pvar actualwidth=''
2 s0 z8 f& a+ y+ q: R2 }' }2 Ivar cross_marquee, ns_marquee3 i8 X6 B( } Z- j
. v! Z, L5 k$ F* p5 Ofunction populate(){7 w* V$ H# w3 S# H" Z4 M6 a
if (iedom){
6 A! U p7 w# g/ Ecross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
7 ~- y t( n, D' B5 y* |( Wcross_marquee.style.left=marqueewidth+8, J& B5 n- X/ k' k, @
cross_marquee.innerHTML=marqueecontent0 L# y9 ?+ q7 V& L3 F" D6 z
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth5 w9 f2 Q) y. c
}
& L7 v+ L7 |# O& U* Nelse if (document.layers){- H2 B- m- P2 f% O, a7 D3 n
ns_marquee=document.ns_marquee.document.ns_marquee2
& L' t" Y+ Q, @# d2 O( fns_marquee.left=marqueewidth+8$ A" j) c- N) L. A0 y$ s4 i& v% q
ns_marquee.document.write(marqueecontent)6 a1 }* i' L" |2 J
ns_marquee.document.close()) `- }5 X. D0 d9 X
actualwidth=ns_marquee.document.width
0 X: P( v" {& q) N}0 |, ]7 v; L+ T6 `8 Q" `7 a7 h8 M
lefttime=setInterval("scrollmarquee()",20)
/ M4 U& \5 L0 ^/ C0 o}
+ d! j4 P' ?2 R: d4 t& X8 fwindow.onload=populate" J ^' C2 s9 {4 I) C3 Q" o* a! z
4 g6 `3 t& }6 m& \( Y
function scrollmarquee(){
0 ?: E0 u, `: X `" q% u; oif (iedom){
$ j- j: H3 m+ X) w% n; Y2 V0 ]if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))( Y0 }& U. I. I& q
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed# g4 l( a: o. @0 m0 n1 S
else5 B1 a8 w6 \& l# n/ ]! H: r
cross_marquee.style.left=marqueewidth+8
2 x3 {3 y& Y p# r: h
* P+ _4 R h' E2 b9 [+ ]2 ]}# S4 v! ]4 e: T7 R: u A
else if (document.layers){
. A1 Q8 C( Y& ]0 V6 U' `+ ~if (ns_marquee.left>(actualwidth*(-1)+8))% T3 ~3 M6 F [6 \' _ E8 r
ns_marquee.left-=copyspeed/ {, } U3 Y+ T8 l, K. e& O
else# E1 n% Y, H3 t- M
ns_marquee.left=marqueewidth+8
/ u* Y( A c; a: I: B1 _}
6 e# u$ h+ V' E* |1 Z, _}% s0 u& C1 ?3 b9 y! j: O1 w
3 W" y9 M1 k! X* _
if (iedom||document.layers){
: [/ U) ^; S' P5 J9 d. Z0 Z8 fwith (document){7 x8 {* }/ l9 {
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')) G6 d" g3 S8 B; C
if (iedom){: X/ n1 F( {2 W1 ]4 S& P7 H
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
5 n+ @# N0 F c& L) p0 Fwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')0 g( a$ R4 ?6 h8 ]
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')+ X' T t: W; |1 E( v: D
write('</div>')
' R( a n/ w+ z1 J, T& Q}+ h8 G5 Z$ X3 w5 p8 n. ? |
else if (document.layers){
7 X f7 r+ \9 k7 S5 x8 i3 c! jwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
6 C6 H# A' [- p) q$ _& ywrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
" k! A1 ^% y# Lwrite('</ilayer>')
$ _4 C8 h; ^8 [}
2 [3 L2 [2 l" ddocument.write('</td></table>')) t0 O* O9 I7 ~& `1 Q$ n6 ]1 o @
}# n1 e+ L4 ?0 {* _+ f& L' W
}
' E, J; V* [: z* [ u( z; h/ z5 U</script> |
|