【javascript】使用window.open()实现弹出广告框

来源:互联网 发布:不定积分 软件 编辑:程序博客网 时间:2024/06/03 01:17

被引用页面:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="zh-cn"><head>    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />    <title>网页标题</title>    <meta name="keywords" content="关键字列表" />    <meta name="description" content="网页描述" />    <link rel="stylesheet" type="text/css" href="" />    <style type="text/css">    *{    margin: 0;    padding: 0;    }        #ad{            width: 693px;            height: 300px;            background-color: lightgreen;            margin: 0 auto;        }        p{            font-size: 60px;            font-weight: bold;            color:#000;            text-align: center;            height: 300px;            line-height: 300px;        }    </style>    <script type="text/javascript"></script></head><body><div id="ad">    <p id="wz">welcome to website</p></div><script type="text/javascript">window.onload=function(){    setInterval("change1()",2000);    //change();    setInterval("change2()",4000);}var Owz = document.getElementById("wz");function change1(){   Owz.style.color = "#fff"; }function change2(){   Owz.style.color = "#000"; }</script></body></html>

引入页面:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="zh-cn"><head>    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />    <title>网页标题</title>    <meta name="keywords" content="关键字列表" />    <meta name="description" content="网页描述" />    <link rel="stylesheet" type="text/css" href="" />    <style type="text/css"></style>    <script type="text/javascript"></script></head><body><script type="text/javascript">window.onload = function(){window.open("js.html","js","height=300,width=693,top=10,left=20");}</script></body></html>


0 0