返回列表 发帖

网页之跑马灯文字特效

//修改宽度
9 L# [% _9 K' U% h- f8 t5 ivar marqueewidth=300# M5 B+ I1 l8 W- J/ Z# }
//高度
- i3 {- _0 C4 H$ {, Svar marqueeheight=255 _1 Y, H* u- t" T+ {/ E& u
//速度(1-10)
0 D: [# [5 K; \) c7 D$ h' z; ?var marqueespeed=3
+ i0 O: U2 `( ?4 o. e- X//背景颜色+ C3 [  N/ f9 u6 U& H! P5 v8 l
var marqueebgcolor="#FFFFFF"9 E0 H( O, _3 C, F& i7 c
//是否能暂停 (0=no. 1=yes)?+ A) R& Q0 p/ I1 [, ]
var pauseit=1( E6 o6 K4 `+ F1 Q, P! H' W5 {
8 i* Z- _, L! s
//修改显示内容
5 ?% j2 o! X7 ]; I! Hvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
7 x1 ]" W7 }/ S* E: G( d* x' F# p. K% {

# ~: {# H( Q& Z- Q. `! b# g6 r5 O# [////下面不需改变////////////
' M. A: x) d; `0 r9 Z% j6 Q, V5 b0 q- D$ c. c& t* M" C
var copyspeed=marqueespeed( ~$ O+ ?: W# ^
var pausespeed=(pauseit==0)? copyspeed: 0; Y* T7 V4 S* L3 u/ I3 H
var iedom=document.all||document.getElementById- @% ?- Y8 Q# A
if (iedom)
/ K! E4 Y  D. mdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
( w7 u) S4 G6 n; ?var actualwidth=''! j  F  X1 H/ O5 \  U
var cross_marquee, ns_marquee
* z0 d- U# ~9 m6 u: ~# H& T" r5 ^% @/ ?: E( N2 `) q: d
function populate(){
  q+ J9 R* e1 X7 i  m6 cif (iedom){6 ?0 ^; N. q- a  U8 J
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
  m6 I0 E" Z  t, o' bcross_marquee.style.left=marqueewidth+8  {0 w9 B) a& [/ G1 q, P
cross_marquee.innerHTML=marqueecontent& W5 E" V. Y$ m# z
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth# u, l1 g* s# w" N5 i
}
4 C* V! }0 x, l, j$ Delse if (document.layers){
" `9 N5 `3 f% j" C& Y% nns_marquee=document.ns_marquee.document.ns_marquee2
2 j! }. x0 q! d/ Sns_marquee.left=marqueewidth+8% U4 o- I$ Q6 m+ O  ~0 S
ns_marquee.document.write(marqueecontent)
+ a& B! A# j$ g$ T3 [ns_marquee.document.close(); {' K6 w5 S' m$ ?) X
actualwidth=ns_marquee.document.width
, N+ x* X+ T6 h5 _}3 I' w& l: L  i9 i5 {/ C. ~
lefttime=setInterval("scrollmarquee()",20)
0 B: \& r4 ~4 i& ^' V}" \% O' q+ z5 Q$ B  W6 ?$ y( N
window.onload=populate
2 x( i% e  m$ X( v. r, A* B
" b& O: X3 R9 [: p. ?( C$ Vfunction scrollmarquee(){8 r8 O8 z& @0 `" p( U
if (iedom){
8 `3 b/ Z- C3 j; J: |1 k" zif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
8 q  M, ^% v3 M* Z( |. icross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed# {& D, `: m- N# m% b! Y
else
% T* o" v& K5 ]cross_marquee.style.left=marqueewidth+8
- e/ e8 v2 u' g6 d% F& L% G. c  r# k; S+ `' ~0 }$ N( V8 n
}4 m: b% z: F9 i" y, k
else if (document.layers){
' V" q8 ^# Z; cif (ns_marquee.left>(actualwidth*(-1)+8))+ J* u+ Y5 J$ }: Z: k
ns_marquee.left-=copyspeed
4 l2 R! u+ Z) ]* {& Eelse9 i; [( ?4 s; r. k) H, [4 ^4 f
ns_marquee.left=marqueewidth+8
: e9 L3 j4 P1 p: M- b}
' v/ j$ O, c& A- x) t}
0 [/ H8 z+ h7 \- K  i* n6 J3 F) b; a$ }% ^% X% ~- m
if (iedom||document.layers){
  u" F/ t- Y( f$ Pwith (document){
9 a, [% ^9 G& i  F: R2 D. x* P% Ddocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
/ c( v3 y/ V9 {' |' R2 Eif (iedom){
1 D  n8 X# H. P& i7 r6 y) I+ Mwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')0 Z4 A8 f4 A! D# q5 Y) b7 |
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')1 f- i4 f+ y7 m; _3 v1 h4 u2 A
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
8 y. S! H2 Y5 cwrite('</div>')* Z6 x8 M! |, T* ?) ^
}
* b/ F6 s# _% x7 o( belse if (document.layers){
) y8 g! d2 T3 @# f# K) Rwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
3 `: i2 _1 N1 Rwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')) v. W! v2 Y$ D; ^. R+ r: Y3 T. I
write('</ilayer>')
  r1 }% N# z( l4 q% t) W9 J9 Q}
7 K& H' X; T5 k6 d- }) ddocument.write('</td></table>'). q  D! ?8 C% E# k- ]- a9 H4 Z
}/ Y2 I: j" [* q3 H' l
}
% b2 o( q8 J5 \" C0 q6 ]. [</script>

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