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

|
网页之跑马灯文字特效
//修改宽度$ k! X+ v( x. r( ^
var marqueewidth=300
/ f( k) e% Q9 f3 d//高度
5 l5 N( s: N1 W6 Avar marqueeheight=25
. b0 \3 j% |2 H7 T' d//速度(1-10)
5 \7 M2 [6 Z$ t0 i$ Wvar marqueespeed=3
; W5 h) O/ Z1 Y1 @//背景颜色
# Y- R# {, b0 d- y0 e9 z' T# d6 Tvar marqueebgcolor="#FFFFFF"# R1 k8 f4 ` E. o8 [9 H" @
//是否能暂停 (0=no. 1=yes)?- I8 G5 X7 H4 E7 B4 N2 K2 C& a3 x5 h
var pauseit=1% Z- S+ T9 G/ {% P4 q8 u
, G p( w: m1 k% t5 x0 L1 E3 [//修改显示内容
7 q5 M/ H0 u* ^var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'4 s( [' W0 m8 I
! {& \5 P. N7 c/ G$ _/ c6 n
3 G( p; R! ?9 ~" y////下面不需改变////////////
" p0 g! O V, G @9 x# C- Z' S u- B
var copyspeed=marqueespeed
* G( _2 v/ r! @, Ovar pausespeed=(pauseit==0)? copyspeed: 0
5 W8 c# g# o6 O1 yvar iedom=document.all||document.getElementById1 u+ ^0 O0 l6 X* B( R, x
if (iedom)* _) X; Y2 O9 U/ L
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')9 s- F/ E+ m6 o) K
var actualwidth=''
. k e; i# [! v" [8 j: f0 Uvar cross_marquee, ns_marquee$ k% k) [, n, o: K
6 M. I9 L p% a$ b7 Q2 {
function populate(){
( n) A( c. K" w/ O, ?7 E) c2 uif (iedom){7 u& u- q8 B5 q' ^" V( d# ?
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee. Z# l! w d" s! S# q
cross_marquee.style.left=marqueewidth+87 w" x, Z7 P) `
cross_marquee.innerHTML=marqueecontent, U1 B6 _( p% Q
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
; i* l9 j0 E& v6 L5 H( Z}
* Y9 B* E+ ?) Aelse if (document.layers){
! s6 U" p) f7 Q+ Y1 Fns_marquee=document.ns_marquee.document.ns_marquee2
0 ^ t- ?- P4 d% X& h/ @6 Ins_marquee.left=marqueewidth+8
! {2 O& ^7 i" L) h+ Q/ bns_marquee.document.write(marqueecontent)7 n0 n: W5 X) e- H) `
ns_marquee.document.close()
& s8 k8 D7 a8 b' R* y- t2 I- Pactualwidth=ns_marquee.document.width. b9 L, ]. J8 [+ J1 R
}' f, q4 \5 |( B3 N! w7 X5 d- I
lefttime=setInterval("scrollmarquee()",20)
& R- s) _ z8 r- w, ~}- D8 N) w" d: s2 `
window.onload=populate0 y( y2 V! s- L" J8 `& n4 c2 c; Q
; i6 K+ q! q" {9 W& f3 c" l4 v
function scrollmarquee(){
4 `$ Q! w" A8 l9 K$ p. ]$ V2 F7 uif (iedom){5 N4 u$ ~2 E' O! e+ q/ y
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
" Z4 g: X) a$ y0 ycross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed% k& U, U, e9 b
else
3 p, U' p* t% ^3 z, h, z7 g6 F+ N# Hcross_marquee.style.left=marqueewidth+8
% x+ ]/ |: \7 r7 i& h' b S; X+ }3 I8 o2 [9 f/ d
}
5 [( B% v* e- A5 y7 Delse if (document.layers){
! i9 _ H+ I8 @& hif (ns_marquee.left>(actualwidth*(-1)+8))
. Z' k+ L& j7 \3 ins_marquee.left-=copyspeed! _8 E& M" ?; u6 n% S, y/ U
else7 u0 e6 Y: T6 D1 r3 s% _( Q* c. e' s
ns_marquee.left=marqueewidth+8
5 M* @9 v& ^1 E}
( ?; z5 j7 ~; ]( @" g}
+ l! G' G0 {9 t1 m
: L' k7 b7 L, ~$ P% w$ _' y7 uif (iedom||document.layers){
1 Q1 S$ _5 N% U" d- s- Iwith (document){0 V8 A; n" _/ Q/ B! z5 h; f
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')+ n3 Q8 u; ]% |' L. L2 d
if (iedom){
( T$ f) J# O' v7 r9 Vwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')6 w4 |( y7 U* u6 c% h2 I
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')7 f1 {9 L! n4 D; f; H& m
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
( ?# `7 V4 A4 u2 K) X: zwrite('</div>')
% B8 \; @5 @! I5 ?' m}
$ x% N. [8 d$ f# C9 w! lelse if (document.layers){
! h/ W& h- ~, }! ?7 R' e& Twrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
% n% t! L$ [( J. m3 l" Wwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
7 X. d! C* u) d; {0 ]1 m0 Lwrite('</ilayer>')# |! \7 Z' B" z+ {
}" W, I- a/ F" _: {: l4 h6 T
document.write('</td></table>')
& A, Z: K8 F* O+ A6 z, W* e}
; F A+ N/ W( @, N}2 y6 U% H9 O4 P, ?! k
</script> |
|