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

|
网页之跑马灯文字特效
//修改宽度
; G" ^$ u4 Z, H, K# Yvar marqueewidth=300- x# \: I* ~" o
//高度7 ^, n- s6 N5 q& R% z
var marqueeheight=255 P0 T# h! s3 K6 B2 e% x. t- `
//速度(1-10)( P# f/ W! }4 R t( E
var marqueespeed=3# ^+ ~, i- d' f6 R `6 x8 g8 R: i" p
//背景颜色
( k8 p3 x1 y( v$ k- A) t1 X# j' G/ hvar marqueebgcolor="#FFFFFF"
0 A; d! ~5 ?$ u//是否能暂停 (0=no. 1=yes)?
* }/ D1 k* k/ i1 u' [* \) H. X; e# Bvar pauseit=14 ?0 e9 L" Y9 ]" f* p! G c& H
$ s, ?4 j9 C6 B: J' A
//修改显示内容
$ T& I6 B/ [9 w- T; }1 f Kvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
+ g, l+ n& ~4 G* s/ w; Z
- ^+ [2 M! I# @: ?, J" R8 M
% x: v7 w- e* S* d- j% f////下面不需改变////////////2 p' J. t0 {5 l' |. @
: H8 D4 C% H: t' d# X, P4 tvar copyspeed=marqueespeed$ @& L5 U# S. t6 O: e' S
var pausespeed=(pauseit==0)? copyspeed: 03 V% F' K" d/ U
var iedom=document.all||document.getElementById4 I+ u6 s. J! t2 {
if (iedom): C" g s; N2 _; b7 U9 r
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')9 e7 Z1 G q: K' B( `6 @
var actualwidth=''7 u' w/ c# C, S
var cross_marquee, ns_marquee
% R4 M! b& E0 I0 E4 |) l L8 N* [: H5 q5 Z
function populate(){8 o$ J4 U* Q; Y: f4 F
if (iedom){
6 g) b* P9 G7 o4 qcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee( w' ?8 A* e/ \
cross_marquee.style.left=marqueewidth+8
8 {; B: }0 r$ j' ^$ k( gcross_marquee.innerHTML=marqueecontent
) `5 U) ?1 L. h" g) _7 Yactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
2 W! e# N" q- E4 @* B}3 `$ K+ O& U. L O0 ?# R q: l) f% j4 B
else if (document.layers){
, N! K- a) R8 m: ons_marquee=document.ns_marquee.document.ns_marquee2
7 `. l0 r: f) x. h/ Ens_marquee.left=marqueewidth+80 ?0 A% T) g9 }# m5 J O+ r
ns_marquee.document.write(marqueecontent)
& I6 ?, [ t" a3 Qns_marquee.document.close(); m0 g, g$ X. |8 R9 L" K3 X& s0 c8 W1 d
actualwidth=ns_marquee.document.width
/ @4 \$ \9 P' f/ \% `& r- ^}
- I7 s5 f( \% S3 r$ c/ Alefttime=setInterval("scrollmarquee()",20)1 s, z8 V W* i5 }
}- D: J: U" y* y/ G/ f
window.onload=populate* Q- i+ ^$ i& b; {
, i: ~* O: @. H6 L
function scrollmarquee(){
1 e l- z. L, U3 o5 o% w- m* ?if (iedom){. d& F, T/ X, }5 G7 {
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
% E+ P! O9 _, {9 ?8 o6 Icross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed% v2 Q! o+ \3 M! R1 k c7 o
else
7 {' z5 M' e* _, {5 k# scross_marquee.style.left=marqueewidth+8# {! P3 W' F/ f. l( N) R3 @$ A
4 z! ?- B% @0 L; g5 Z1 y1 M} z. n9 F' z1 R+ m5 s8 w2 p9 v
else if (document.layers){
9 o# V3 s2 D2 s5 z1 hif (ns_marquee.left>(actualwidth*(-1)+8))# s x0 m! A9 I0 i- c2 n
ns_marquee.left-=copyspeed' ?+ |) `) m( M% u2 t
else4 q( R! h7 b w( P1 W+ k- H6 N/ l. T
ns_marquee.left=marqueewidth+8: U9 j1 K8 T) I
}; [6 z& u, o, i1 s, N, U
}
! E; t& Y8 q7 `% n5 {
" i9 N) }' V' M0 y" Yif (iedom||document.layers){# A% c3 D% a: x% o. K N
with (document){
5 n" L4 Z2 q9 s0 ydocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
6 h; _, \' l; u3 rif (iedom){
! \$ }* _# G( ]4 P4 ~8 Twrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')0 w0 y8 s/ g5 n& M# C- o
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')" e- {: `2 r1 A- `( V. T, A% r
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')/ m3 \5 f/ y/ @& N# ^) {
write('</div>')
" U' A0 N0 L2 s3 T6 F+ G}- N5 F3 R0 S: f0 O6 E
else if (document.layers){
3 }" x* V. Y# j0 [) ~1 T7 zwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
x3 e% L1 B6 U" iwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
3 t. W: } w- Q! ?1 Y2 Fwrite('</ilayer>') s/ ^# K( O6 R" g( k7 S" B1 }
}
$ Q9 D, G4 r$ P" U: S6 kdocument.write('</td></table>')
4 I# h: o7 W; m0 H}
" b- r: z# h+ A8 a* F1 @/ F}
0 K4 ?! U5 R% ]</script> |
|