返回列表 发帖

网页之跑马灯文字特效

//修改宽度6 {1 F' F  L5 Y4 |
var marqueewidth=300- n* U5 u) x1 Q- m5 i
//高度* n2 U* g8 c1 g: y
var marqueeheight=25% @7 w  H: `, ^7 R# h1 Y8 I& G( h
//速度(1-10)3 z; J2 l9 W$ Y- V# ^) j5 X# t3 H
var marqueespeed=3
  i- A5 @2 E+ Z5 `$ N% J//背景颜色
; g" ?6 v$ d5 `' P/ x. z5 Qvar marqueebgcolor="#FFFFFF"
  D. p9 {* R& R//是否能暂停 (0=no. 1=yes)?7 z8 Q, T9 M- q4 s; ~& o
var pauseit=11 @5 a4 y8 D9 L/ R6 N

+ d% Z0 [. a# @# M! G5 d9 K//修改显示内容* s, j$ Y0 t' L* B
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
* m8 S1 A* X7 R5 r7 n$ C- u
+ r' F4 u0 v5 b7 ~. _' H; \, `: Y$ K$ E2 @0 U) w$ ]' B2 C
////下面不需改变///////////// E) G2 a* `6 A2 E3 m

, @6 O- f0 G; w: R9 I5 E- _var copyspeed=marqueespeed
8 \6 j0 z8 C$ A  N. r$ Nvar pausespeed=(pauseit==0)? copyspeed: 0
( o. m# u5 z$ K: E. Tvar iedom=document.all||document.getElementById/ x- R/ w* [+ Q2 _$ h0 s# K( G9 e3 P
if (iedom)
) t) Z3 a8 {2 l* N1 }1 k( Edocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')9 j$ S6 z5 Q' r+ ]9 z( t- w
var actualwidth=''9 b: i6 N% e" d1 L* `1 Z( A
var cross_marquee, ns_marquee! J, k3 v; Q3 u

# [! z* O0 ]. M# c. \8 sfunction populate(){1 P; m- v7 |5 f/ O4 N
if (iedom){" H7 i( a' e0 K" w% h$ U9 E
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee$ E3 q6 a+ W+ I) L! ?( F1 z+ B
cross_marquee.style.left=marqueewidth+8. O: H& o0 f5 G+ i+ L" `* j
cross_marquee.innerHTML=marqueecontent0 f9 K0 U' V1 v. _) h
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth7 {$ B  E( S& ^8 O/ s4 p
}
7 G/ E2 o4 O8 q, c5 T5 Eelse if (document.layers){
, W; E  i  h* I. Y; u- r) E* N. hns_marquee=document.ns_marquee.document.ns_marquee2  z; z3 |6 R5 p
ns_marquee.left=marqueewidth+8
% F, b. X; j- U+ r2 ]2 Lns_marquee.document.write(marqueecontent)$ Z8 F6 ^6 \4 H5 N* g( P" b; ]* @
ns_marquee.document.close()4 }* @* S$ y! f7 c7 @8 i: J
actualwidth=ns_marquee.document.width$ U* b9 j- P+ x8 j8 u% v. i, {9 i+ F
}
0 t7 o; V( o- p7 U+ A7 Tlefttime=setInterval("scrollmarquee()",20)$ g- I1 a3 Q3 s7 |
}. I7 l2 M- t1 q$ L
window.onload=populate
) v* [1 Z% x2 d# X
+ D0 t; T" X' nfunction scrollmarquee(){
+ w( {/ d+ u5 t. o$ wif (iedom){/ ]$ `1 O5 i8 U$ y
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
) L. q2 r  U7 ?cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed  N* ^. |; g0 A* j# m. @
else
$ z3 X9 x: {& h+ w5 Ncross_marquee.style.left=marqueewidth+88 W0 H- S) o' a, l) B, {6 x( ^9 Y

$ z2 K# m& a2 S}
! e* m3 O; Y! x, M1 v: Z( uelse if (document.layers){, ]  S! `* @; H% r2 a
if (ns_marquee.left>(actualwidth*(-1)+8))! Z) s0 ?# J. f
ns_marquee.left-=copyspeed
& K' z5 ^1 X3 g  A% H) \else
+ `( W7 w& w( Ans_marquee.left=marqueewidth+8+ v- \# _- P$ D6 a: f. `. f8 \
}
% W* X% k+ Y9 |* n8 n8 y7 f}3 y8 }6 C; J( z, i/ F2 R
3 ?7 z- d) d. C
if (iedom||document.layers){- Y: V% b. O! t( l
with (document){
' D$ z" i/ X# m5 J5 Ddocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')0 \( W8 i& X: l
if (iedom){6 g4 Y2 A' T+ k6 I' p4 {
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
4 L( F: o) N' d; k. [& H6 p# swrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
8 D- T, D- O2 k! dwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
: H: F2 @6 b5 G" wwrite('</div>')
- n1 Y* r" B: Y  L! S1 z& z) d" o}
/ f5 p, [( N; s4 j/ z) n/ L: t0 m, qelse if (document.layers){
, ]7 I0 p8 L/ _1 vwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')* C5 h$ O8 [$ g7 m
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')5 d  K% U) e- H; C2 Q& O$ @# _
write('</ilayer>')
/ v/ h3 C4 H2 W}1 ^- j# t3 u- F7 u$ o
document.write('</td></table>')
* s+ x1 s& n  Y, x}
8 _! O; r+ E5 P. g}0 w( p7 b7 @0 G' R
</script>

返回列表
【捌玖网络】已经运行: