弹窗,从基本开始

1.模态窗口

<script type="text/javascript">
  function openW(){
   var url="2.jsp";
   var param=window;
   var pros="dialogWidth:400px;dialogHeight:200px;center:yes";
   window.showModalDialog(url,param,pros);
  } 
 </script>

 

2.无模态窗口  <script>
 <!--非模态窗口-->
 function doselct(){
  var url = "studentInfo.html";
  var vArguments = "传递参数";<!--新窗口,可以使用window.dialogArguments来取得参数-->
  var arg = window;
  var pros="dialogWidth:400px;dialogHeight:200px;center:yes";
  var result = window.showModelessDialog(url, arg, pros);
 }
  </script>

 

3.iframe

function fnPopup(){
    var is = document.getElementById('popup').style.display;
       if(is == 'none'){
        document.getElementById('popup').style.display='block';
        window.frames[0].location.href="2.jsp";
       }else{
        document.getElementById('popup').style.display='none';
        window.frames[0].location.href="2.jsp";
       }
   }

 

<input type="button" id="openWindow" onclick="fnPopup();" value="弹窗窗口 "/>
 
 <div id="popup" style="border:1px solid #606060; width:320px; height:240px; display:none;">
      <iframe id="myFrame" src="" style="width:100%;height:100%;"></iframe>
  </div>

 

你可能感兴趣的:(弹窗,从基本开始)