<!doctype html>
<html>
<head>广告</head>
<meta charset="utf-8" />
<style type="text/css">
#gd{width:200px}
img{position:fixed;right:50px;height:50px;} /*固定定位,表示距离右边窗口50px,距离上边窗口50px*/
a{position:absolute;right:0px;} /*还可以给连接加样式*/
<script type="text/javascript">
//网页加载完成弹出广告图片
window.onload=init;
function init()
{
window.open("打开的一个路径","窗口名字","窗口打开的位置等属性")
}
function hidden_img()
{
document.getElementById("gd").style.display="none";
}
</script>
</style>
<body>
<div id="gd">
<img src="路径" width="200" height="200" alt="这是广告图片">
<a href="#" onclick="hidden_img()">关闭</a>
</div>
</body>
</html>