js或者CSS带关闭的漂浮广告代码

JavaScript021

js或者CSS带关闭的漂浮广告代码,第1张

<html><head><title>固定在底部的漂浮广告</title></head><body><script LANGUAGE='JavaScript'>var ad_float_left_src="http:/images/logo.gif"var ad_float_left_url = "http:"var ad_float_left_type = ""document.ns = navigator.appName == "Microsoft Internet Explorer"var imgheight_closevar imgleftwindow.screen.width>800 ? imgheight_close=120:imgheight_close=120window.screen.width>800 ? imgleft=15:imgleft=122function myload(){myleft.style.top=document.body.scrollTop+document.body.offsetHeight-imgheight_closemyleft.style.left=imgleftleftmove()}function leftmove(){myleft.style.top=document.body.scrollTop+document.body.offsetHeight-imgheight_closemyleft.style.left=imgleftsetTimeout("leftmove()",50)}function MM_reloadPage(init) {if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {document.MM_pgW=innerWidthdocument.MM_pgH=innerHeightonresize=MM_reloadPage}}else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload()}MM_reloadPage(true)function close_float_left(){myleft.style.visibility='hidden'}if(document.ns){document.write("<div id=myleft style='position: absolutewidth:80top:300left:5visibility: visiblez-index: 1'><style>A.closefloat:link,A.refloat:visited {text-decoration:nonecolor:#000000font-size:12px}A.closefloat:active,A.refloat:hover {text-decoration:underlinecolor:#0000FFfont-size:12px}</style><table border=0 cellpadding=0 cellspacing=0><tr><td>")if(ad_float_left_type!="swf")document.write("<a href='" + ad_float_left_url + "' target = '_blank'><img src='" + ad_float_left_src + "' WIDTH=100 HEIGHT=100 border = 0></a>")elsedocument.write("<EMBED src='" + ad_float_left_src + "' FlashVars='" + ad_float_left_url + "' quality=high WIDTH=80 HEIGHT=80 TYPE='application/x-shockwave-flash' id=changhongout ></EMBED>")document.write("</td></tr><tr><td width=80 height=20 align=right><a href='javascript:close_float_left()void(0)' class=closefloat><font color=#0000ff size=2>关闭<font></a></td></tr></table></div>")myload()}</script></body></html>

复制代码

代码如下:

<html>

<head>

<title>javascript实现div浮动在网页最顶上并带关闭按钮效果实例</title>

<style

type="text/css">

<!--

body

{

margin:

0pxpadding:

0pxtext-align:

center}

TD

{FONT-SIZE:

12px

COLOR:

#333}

#toubiao

{BORDER-BOTTOM:

#e2e2e2

1px

solid}

-->

</style>

</head>

<body>

<SCRIPT>

function

toueme(){

document.getElementById("toubiao").style.display="none"

}

</SCRIPT>

<DIV

id=toubiao>

<table

width="100%"

border="0"

cellspacing="0"

cellpadding="5">

<tr>

<td

width="82%"><a

target="_blank"

href="/">

<span

style="text-decoration:

none"><font

color="#808080">悬浮在网页顶部可关闭的工具条(浮动层),点击可以关闭哦</font></span></a></td>

<td

width="14%"

align="right"><a

style="CURSOR:

hand"

onClick=toueme()>

<img

src="../img/close3.gif"

hspace="6"

border=0></a></td>

</tr>

</table>

</DIV>

</body>

</html>

</td>

</tr>

</table>