2:(用setTimeout()做)实现一个首页,当装载首页时,弹出广告窗口,广告窗口将在5秒钟后关闭

来源:百度知道 编辑:UC知道 时间:2024/05/15 06:20:59

<style type="text/css">
body{margin:0 auto; background-color:#393939; font-size:12px; font-family:"宋体","Times New Roman", Times, serif; width:1004px; text-align:center;}
</style>
<script language="javascript">
function showad()
{
document.getElementById("ads").style.display="";
setTimeout("document.getElementById('ads').style.display='none';",5000)
}
</script>
<body onload="showad()">
<div style="width:1004px; position:relative; height:0;"><div style="position:absolute; left:0px; top:0px; height:600px; width:1004px; display:none;" id="ads"><a href="#" target="_blank"><img src="https://gss0.bdstatic.com/70cFsjip0QIZ8ty