返回列表 发帖

网页之跑马灯文字特效

//修改宽度
3 k/ z( U6 F/ L3 F# Evar marqueewidth=3001 |6 Y4 C# [. c! X7 J
//高度/ |; w1 g, s% F2 t' x
var marqueeheight=25) R0 H& H. U( j4 e
//速度(1-10)
  R% r2 K5 P9 o' q, F" a" w$ U# U/ Vvar marqueespeed=3
( b) {+ Q. [/ G& j//背景颜色. r+ \  H7 V# X2 z% i' L
var marqueebgcolor="#FFFFFF"7 Z9 s" ~5 C' _8 j7 {  t
//是否能暂停 (0=no. 1=yes)?
% n$ ]0 Y6 K* o* P& F5 Tvar pauseit=1
4 a7 k9 R/ F5 E: b
) m; \: u  L+ ~//修改显示内容
+ [, Z- `& B4 B# `7 {var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'+ n  q2 |8 `/ t+ k( v1 C

5 h2 K) V7 J" E3 h3 c' Q4 _$ {3 v6 @
////下面不需改变////////////
: F9 U! o; K6 S' Q. Q+ V4 H! t7 ^5 b$ y8 D* ^) ?
var copyspeed=marqueespeed
+ q: k9 O  [6 a! o+ A" c# r! tvar pausespeed=(pauseit==0)? copyspeed: 0
$ l7 x' P4 p) O/ Ivar iedom=document.all||document.getElementById- H& g. Q: e2 i" u# j5 F8 {
if (iedom)) q' o6 n/ l% t) `. ]% X
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
  |$ Y! a" G0 H4 ]var actualwidth=''' U% S# R$ e2 N- G
var cross_marquee, ns_marquee
& i' r0 B# G) W
* X$ \% U. b" I# \# ?/ rfunction populate(){
& }6 e8 {9 ^' c4 uif (iedom){$ z+ e: U3 H) ]3 M2 `' ]: j
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee8 P7 Q9 x: j, C  z  V! i2 A$ J
cross_marquee.style.left=marqueewidth+8
# S  L9 I: M+ R2 n7 D# Mcross_marquee.innerHTML=marqueecontent% j: c5 O& b% ~# I5 |2 a' [
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
+ L: ]1 T, W9 s$ i5 `- N. }}
7 e) m! r& |# q6 H" R1 _0 i' {else if (document.layers){& ~' w$ @( _9 a2 p) A
ns_marquee=document.ns_marquee.document.ns_marquee2
. ]& U5 h- p0 S4 j5 Z1 `! |ns_marquee.left=marqueewidth+8+ h  @: j2 H4 i0 L" {, t
ns_marquee.document.write(marqueecontent)
# y0 J3 J4 G& Q$ U3 k; `ns_marquee.document.close()
( E) y6 X3 U8 e2 j5 w3 [actualwidth=ns_marquee.document.width
% c8 i' l2 G, u- f) N! J  n! P}* f" F% _: A5 {, @; ^! [+ _; q
lefttime=setInterval("scrollmarquee()",20)
7 E( x, X* G* a5 g4 N/ I  M. a}# F, U: L. {* |' d" F
window.onload=populate
6 |5 z4 V, F2 Y/ u& ~. ]' R, ?2 W/ U9 r6 X# b, x1 k" m# C
function scrollmarquee(){3 f- i: [/ }: e, l( I' b4 U4 p
if (iedom){7 R8 ^! T$ L! f* d2 p
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))2 R) M/ h- L6 ]6 K
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed$ X# J: s* h. g8 L& a
else. \) y5 y  h1 p' U' F' Z
cross_marquee.style.left=marqueewidth+8
  k5 V  C- J  a! H( Y6 X0 T6 P$ |, p" X  h' X! h7 |: R% F
}0 K; M  a/ {/ K6 h
else if (document.layers){8 D8 \# b- Z- O# v- L
if (ns_marquee.left>(actualwidth*(-1)+8))5 i2 |# N) ]! L. B* U
ns_marquee.left-=copyspeed
  m5 T  F/ Y! ?else# Y+ D$ b3 t2 o* I
ns_marquee.left=marqueewidth+8
6 I! u9 I6 L- M5 i. @0 {}+ w4 s% F( o+ z/ w  O$ d
}8 f6 z) C; P& d+ f: I+ M- \

( X8 j4 [, ^3 S, c7 Vif (iedom||document.layers){
" n1 f7 l6 c( K9 mwith (document){
4 b& U# m! o/ {, l4 ]document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
3 S7 h# I# g, \if (iedom){
0 [; F3 d% D" y: A6 ?/ Cwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
- I, H1 H7 Z4 y) P9 twrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
- V5 c- Q, f, Owrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')4 {4 w4 k1 R- d) R5 A
write('</div>')
0 [8 x( }% W7 J5 t% M/ B}
( n( G9 b8 v4 Ielse if (document.layers){
3 Z. X3 p6 O" B# E' Ewrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')7 s/ p# |! ]3 ~- d: N  ~* |5 L
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
/ N8 Y" H; `* L+ ^write('</ilayer>')  W1 w* V+ N' g: e
}
0 T8 E6 F0 s5 Z, q* ndocument.write('</td></table>')
# c9 y7 Q. G) w3 U3 O6 m$ u}* w5 J! X4 w4 @$ c$ b
}9 }/ b; ?* w) d1 a! ^
</script>

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