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

|
网页之跑马灯文字特效
//修改宽度% s I: x r* G- v5 L, D' r* b+ R
var marqueewidth=300 w: W7 D" O. c; ?- b- u: V
//高度
: }" W1 E a8 D% Avar marqueeheight=25
# k4 M+ W( a- U2 \4 Y& ^& w//速度(1-10)& r4 B% |0 J+ c: o8 r
var marqueespeed=3
, E4 L6 d, Y/ u//背景颜色' T1 g; K, ?9 O
var marqueebgcolor="#FFFFFF"6 m3 h$ }: V( Z& ~4 C# G
//是否能暂停 (0=no. 1=yes)?
' M$ _5 E% N, h9 s( Q- T Lvar pauseit=1
9 Z4 u! I. V4 J* S1 h4 W/ n# O+ P
//修改显示内容7 O# U$ k' k/ b: p1 O5 s
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
2 p0 a% j. V7 I7 s
9 K5 N6 F {3 v" X! I. A E% j& W3 r2 s8 d! l3 s7 U
////下面不需改变////////////
% H) o- }1 c+ ^ M+ ^% \- T% [
9 ?' s+ d, t2 }! R+ M1 C( ^# `! qvar copyspeed=marqueespeed. ^4 h$ T- h8 v0 Q. F# E) Y
var pausespeed=(pauseit==0)? copyspeed: 07 [9 L' R1 z8 X- g& K
var iedom=document.all||document.getElementById
! Z! n: l8 Y( g: X' ]* A; O/ Gif (iedom)6 Q4 A3 a' z. M' g+ n" z0 H3 `
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')) {* ~) o) _. @" \$ E
var actualwidth=''1 n. C' l/ x6 S& E/ v
var cross_marquee, ns_marquee9 ]5 r7 Y! s9 g$ @: f5 f7 w+ ?7 s
$ d. s6 M! q& w1 P
function populate(){
) W3 Z' H* }) w* t2 o ^0 u* Wif (iedom){
0 Z; ?' {9 d# p! v4 b. O7 lcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee' o, H8 T' P" z& u
cross_marquee.style.left=marqueewidth+8
* y- y0 }7 ^+ tcross_marquee.innerHTML=marqueecontent# o% C1 @* I) ~% D* ~ W5 z
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth, d8 J6 x3 n2 N4 M
}; G; `" b2 c0 a( Q( m; C- q
else if (document.layers){
4 e% } P1 H" @+ y: W3 A2 x% ons_marquee=document.ns_marquee.document.ns_marquee2
5 Y7 f* P9 ^! U3 ]ns_marquee.left=marqueewidth+8
- ` b1 n( d' e3 tns_marquee.document.write(marqueecontent). N2 j: |1 O+ A2 Y+ C8 k8 f
ns_marquee.document.close()& L( Q9 v) R, u$ b
actualwidth=ns_marquee.document.width1 b. W0 D& h1 Z3 u, y2 o" I1 ^2 U/ a
}8 _" |6 ]+ P M1 h( B5 R
lefttime=setInterval("scrollmarquee()",20)
7 h8 u& Q4 h" u. ^! g; v}' v* @1 h3 y" k( D
window.onload=populate% t- y! |+ i8 s, l# L
" ~2 q0 D4 J5 w. ^ ]1 T7 C" _
function scrollmarquee(){
! G- @- v- ?4 K5 i% M5 X5 E- p8 yif (iedom){' t# S0 g! Q% q' l' a" | D
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
! ?. H8 e" B" w# Jcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed/ n7 ]5 C" [& I7 w
else7 p/ M) ~5 J H2 S: d; p
cross_marquee.style.left=marqueewidth+8/ U, f% P: t, H1 ^ o9 ~
8 ~: X# ?% d. K}6 m* T+ ~* y5 H. O( k9 y5 N- V
else if (document.layers){( @2 d3 `! s `' i
if (ns_marquee.left>(actualwidth*(-1)+8))% \/ L; P! H' w& d O0 {
ns_marquee.left-=copyspeed( ~5 l0 F% o# G0 a
else! B8 s+ J4 W' p+ l5 K
ns_marquee.left=marqueewidth+8/ Y9 |( m+ V/ L" E' {* @
}2 [6 W( p- J2 c" C' ~: N6 O
}
! Z A/ z) Q4 X- ^6 {! Y O4 c( Y! b
if (iedom||document.layers){
0 h0 R) j+ ^7 k! v" jwith (document){$ ]: x0 G4 U. x# }4 Z Y2 J
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')- r6 F" o5 p( f2 K- w
if (iedom){- E9 m: y9 l8 x
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
6 v* Q7 K# j3 i$ `5 _" @1 Wwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
: l( p- L, m+ Hwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'): r0 f, N% L8 z0 m
write('</div>'), a) m+ Z3 t) W9 N, D) O
}4 u, e) g3 V( O6 h4 x8 c; ?) N
else if (document.layers){8 h& E, [& y; m. m3 C% p1 G4 C
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
4 j" p( P/ E: X" N# {( \# Xwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
1 r/ i8 x" M3 ]/ u% B6 kwrite('</ilayer>')
) Q7 v4 C6 z, I% ]# ^. k}
: C9 }% _/ c) j. |! H: H+ ^! Sdocument.write('</td></table>')% m U. U) a! L' V2 \" l+ f5 d
}4 }5 w3 h. z* U6 V! Y
}5 ~8 V2 G7 _/ E, m( K
</script> |
|