Php

2016-03-30 20 views
0
<form onsubmit="window 
    .open('paper.php?start_t=yes&pass_sub_id=<?php echo $qr1;?>', 
      'print_popup', 
      'width=1000,height=800');"> 

Yeni bir pencere açtıktan sonra ana pencereye nasıl gidilir Yeni pencerede açılacaksa, yeni açılan pencerede gönder düğmesine tıkladığınızda ana sayfaya geri dönecek ve bir URL açılacaktır.Php

+0

Geçerli pencerede yeni bir pencere/sekme açmak yerine kalıcı bir pencere kullanırdım. – jeroen

cevap

0

Bu kod açık yeni bir pencere ve window.location.href="newLocation.html" benim için işe yaramadı çünkü bu şekilde yaptım

<!DOCTYPE html> 
<html> 
<body> 
<p>Click the button to open the new window.</p> 
<button onclick="myFunction()">Try it</button> 
<script> 
    function myFunction() { 
     var newWindow = window.open("popup.htm", "popup", "width=200, height=100"); 
     console.log("LOG 1:"+newWindow.location.href); 
     newWindow.addEventListener("beforeunload",function(event){ 
      loadNew(); 
     }, true); 
    } 
    function loadNew(){ 
     var xhttp = new XMLHttpRequest(); 
     xhttp.onreadystatechange = function() { 
      if (xhttp.readyState == 4 && xhttp.status == 200) { 
       document.getElementsByTagName("html")[0].innerHTML = xhttp.responseText; 
      } 
     }; 
     xhttp.open("GET", "popup.htm", true); 
     xhttp.send(); 
    } 
    </script> 
</body> 
</html> 

... Bir XMLHttpRequest yapmak ve yeni içerik getirmek için olay beforeunload dinler ..