我想做成“打开页面右下角弹出一个小窗口”,可是现在一打开页面就显示两个页面,一个是index.htm另一个就是ad.htm
怎样才能实现“打开页面右下角弹出一个小窗口”的效果,下面是我的代码:
index.htm<html>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<head>
<title>在右下角弹出窗口</title>
<script language="javascript">
var w=300;
var h=180;
function pp()
{
var t=window.screen.width-w;
var l=window.screen.height+h;

var name=window.open("ad.htm","","width="+w+",height="+h+",top="+t+",left="+l);
}
pp();
</script>
</head>
<body>
<img src="49e989c0t671566455b1e.jpg" width="499" height="556">
</body>
</html>ad.htm<HTML>
 <BODY>
  <img src="49e989c0t671566455b1e.jpg"/>
 </BODY>
</HTML>

解决方案 »

  1.   


    <!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">
     <head>
      <title> Sohu_Crazy </title>
      <meta name="generator" content="editplus" />
     </head> <body bgcolor="#E6E6E6">
      <script type="text/javascript">
      <!--
        
    var isIE6 = (window.XMLHttpRequest) ? false : true; var $ = function(sId){
    return "string" == typeof(sId) ? document.getElementById(sId) : sId;
    } var Scroll = function(){
    this.oMaxContianer_Width = 338;                      
    this.oMaxContianer_Height = 280;                     
     };  Scroll.prototype = {
     FixMaxContainerScroll: function(){
    this.oMaxContainer.style.top =  d.scrollTop + d.clientHeight - parseInt(this.oMaxContainer.offsetHeight, 10) + "px";
     },  CreateMaxContainer: function(){
    document.write("<div id='oMaxContainer' style='width:"+this.oMaxContianer_Width+"px;height:"+this.oMaxContianer_Height+"px;z-index:12299;border:2px solid red;'></div>");
    this.oMaxContainer = $("oMaxContainer");
    var oThis = this;
    if(isIE6){
    this.oMaxContainer.innerHTML = '<iframe style="position:absolute;top:0;left:0;width:100%;height:100%;z-index:-1;filter:alpha(opacity=0);"></iframe>';
    }
    this.oMaxContainer.style.position = !isIE6 ? "fixed" : "absolute";
    this.oMaxContainer.style.right = "0px";
    this.oMaxContainer.style.top =  d.clientHeight - parseInt(this.oMaxContainer.offsetHeight, 10) + "px";
    isIE6 &&  window.setInterval(function() {oThis.FixMaxContainerScroll() }, 10);
     },  // 程序初始化
     Init: function(){
      var $d = document.compatMode == "BackCompat" ? d = document.body : d = document.documentElement;
    this.CreateMaxContainer();
     }
     }  var bottom_scroll = new Scroll();
     bottom_scroll.Init();  //-->
      </script>
      <br/><br/><br/><br/><br/><br/><br/><br/>
      <br/><br/><br/><br/><br/><br/><br/><br/>
      <br/><br/><br/><br/><br/><br/><br/><br/>
      <select></select>
      <br/><br/><br/><br/><br/><br/><br/><br/>
      <br/><br/><br/><br/><br/><br/><br/><br/>
      <br/><br/><br/><br/><br/><br/><br/><br/>
      <br/><br/><br/><br/><br/><br/><br/><br/>
      <select style="width:400px;"></select>
      <select style="width:400px;"></select>
      <select style="width:400px;"></select>
      <select style="width:400px;"></select>
      <select style="width:400px;"></select>
      <iframe style="width:100px;height:200px"></iframe>
      <select></select>
      <select></select>
      <iframe style="width:100px;height:200px"></iframe>
      <select></select>
      <select></select>
      <br/><br/><br/><br/><br/><br/><br/><br/>
      <br/><br/><br/><br/><br/><br/><br/><br/>
      <br/><br/><br/><br/><br/><br/><br/><br/>
      <br/><br/><br/><br/><br/><br/><br/><br/>
      <br/><br/><br/><br/><br/><br/><br/><br/>
     </body>
    </html>
      

  2.   

    那你自己在DIV上加个 关闭的小按钮 点击隐藏DIV就得了