简体   繁体   中英

Is it possible to call a popup without using onclick or href?

I have a button that updates the query, after which I want a popup to appear. I have used it like this:

<input type="submit" name="details" value="Details"/>
 if(isset($_POST['details']))
 {
 // update function;

 call a popup;
 }

I don't want to use popup as

<button id="popup" onclick="div_show()">Popup</button>`

Or

<a href="#openModal" id="btn">

I want it as isset(..) , Is it possible? If yes how should I call a simple popup having a message and 2 buttons? (I don't want to use alert, prompt, confirm boxes , It should be a popup). Please help.

If you are making the pop-up with java-script, you can do it like this :

<?php
     if(isset($_POST['details']))
     {
     // update function;

     echo '<script type="text/javascript">Call_PopUp(); </script>';
     }
?>

or even a popup with html (iFrame)

<?php
     if(isset($_POST['details']))
     {
     // update function;

     echo '<iframe> Pop-Up here </iframe>';
     }
?>

You can echo javascript code with windows.open like this:

<?php 

 if(isset($_POST['details']))
     {
     // update function;

     echo "<script type='text/javascript'>var url = 'http://www.google.com'; window.open(url,'win2','status=no,toolbar=no,scrollbars=yes,titlebar=no,menubar=no,resizable=yes,width=1076,height=768,directories=no,location=no'); </script>";

}
?>

The problem with popup windows is that are blocked by all modern browser, can you evaluate modal popup instead of popup windows.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM