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

|
网页之跑马灯文字特效
//修改宽度/ V* b$ ?, ? c b& D) S! A
var marqueewidth=300
" g- {4 c+ v" ~* x//高度, c$ m0 x/ M* Z, a* k9 H. ~+ F7 V
var marqueeheight=25* `& l$ k# ]& e& a4 K
//速度(1-10)# t1 r: ^) \# {+ l& \* x
var marqueespeed=38 l9 P6 @; }' p* K
//背景颜色
$ t8 H" G/ b0 K' ]6 G8 H Y% zvar marqueebgcolor="#FFFFFF"9 M" H3 ~$ N( k- S" q
//是否能暂停 (0=no. 1=yes)?7 d/ w5 L1 \0 [4 S: v4 V _ D
var pauseit=1+ I+ }! N( f) D8 a+ d6 E
% a0 ^' ^6 g) q4 c6 S g+ _
//修改显示内容
( v/ r9 q; d( Fvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
- r" [, A( w L4 o. R. r; P0 B1 Q# X1 v2 b* W( [# p, K' J
9 y. E& a7 i, i5 u
////下面不需改变//////////// E1 ]. z3 ~3 m$ Q8 [4 q9 P
1 I w2 V3 _8 nvar copyspeed=marqueespeed
% |# E" l4 A+ \9 ?9 F# jvar pausespeed=(pauseit==0)? copyspeed: 02 h* o! w$ A, u" _$ t/ a ?7 Z/ L d
var iedom=document.all||document.getElementById
/ A& p7 S% g9 y7 ^5 B6 _3 \. wif (iedom)
+ @+ M1 J+ t- |( edocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')" r& U" x3 F c3 }: }! E. @( U: x
var actualwidth=''8 E9 e( Z$ h! @% p4 E. R
var cross_marquee, ns_marquee, _" A) q4 k: b5 y8 i( {
+ g, X0 |( R3 v q
function populate(){
* O2 v6 ]$ U! N Q% ?if (iedom){
/ Y G8 n+ O* qcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee" s$ a" x7 |% v; @# f2 E
cross_marquee.style.left=marqueewidth+8
6 K- v6 W9 R9 Y; {: @; e- xcross_marquee.innerHTML=marqueecontent. |9 a2 E5 {, Q
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth! Y, L9 c: C1 C( H! O
}
2 o8 |' l/ u2 A7 k0 w' g) e U& selse if (document.layers){
+ T9 H, _3 V( i0 v. B* ?1 @) Lns_marquee=document.ns_marquee.document.ns_marquee2 P! R: V% R V: \1 ]6 l; k2 L; J: |
ns_marquee.left=marqueewidth+89 I1 D7 b" b) {
ns_marquee.document.write(marqueecontent)
2 l# ~, q+ k4 |9 x; Mns_marquee.document.close()
' H' q# R+ V4 s, b. z6 dactualwidth=ns_marquee.document.width6 [9 j& f o% P% a" W; a1 G0 `
}
8 l+ T1 M( u& M5 b) [2 jlefttime=setInterval("scrollmarquee()",20)9 k' Z/ @$ i, S1 Z
}5 ?+ @/ R' e+ U- F* @& u& p
window.onload=populate& t$ ~2 d, `5 `" G
1 m3 ^ ]- ?4 m4 |* B9 c/ `
function scrollmarquee(){
9 o7 @& `; ?1 V0 q cif (iedom){
8 O( Z% e* B' Y/ tif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))' T! O" V( h5 j) f
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed/ {+ U$ n3 D4 C& \7 {9 I, t8 H! p: X
else+ J% d) {: E( y4 p! {+ `3 }6 W
cross_marquee.style.left=marqueewidth+8
N" i2 e& ~% K2 C" N1 e0 c) m# N6 [
" {/ ]8 }; p8 i' O* L( P}( n N- l* e- ^! m9 J
else if (document.layers){+ [. V; m$ i& e7 \, _! F8 O" S
if (ns_marquee.left>(actualwidth*(-1)+8))
+ T9 q- b# f# U& D# @+ n0 vns_marquee.left-=copyspeed
* y5 d$ @+ ]0 x+ W, K5 l3 {* gelse) x( U) {. a6 ~/ o$ B7 X
ns_marquee.left=marqueewidth+8
1 V9 W" j. k o$ H}( S: n- j. j% R' A2 T2 a) m) [
}% P: O6 m+ S& O
: B) c u+ ?3 z0 [, jif (iedom||document.layers){
8 e2 C) T8 N' @with (document){/ w# F1 L$ R1 i, \$ `! Z; z0 A
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
! Z9 H: z' w3 Y* fif (iedom){
4 A+ c# c! a4 \6 Jwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')* G; Q& ^3 q7 B4 W5 Y; l: q
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')( g& ~# P/ l5 I3 X
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
( P8 R/ W% _5 p0 cwrite('</div>')
0 X2 B: a, g9 q! D; J; s6 U}
6 ^% G" Z7 I0 U( Y! J }else if (document.layers){6 P- L- [, }; w8 W' S1 S
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')" k( s+ m: R! }0 ~
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
8 Z* Z. a4 Q1 c. _1 ?write('</ilayer>')
. U/ `0 o) L8 h' V}( l; A- g7 y4 e9 z& A7 | k' g v
document.write('</td></table>')
% {: C5 I- k( f, D$ O6 X: ?}2 P& Y5 l3 o9 u+ v8 f- U
}7 Z" t: g! f4 ?: D
</script> |
|