在php [关闭]按钮点击事件的弹出窗口中打开一个表单

问题描述:

I want to open A Form in popup window on button's click event in JAVASCRIPT. can anybody help me about this??

我想在JAVASCRIPT strong>按钮的点击事件的弹出窗口中打开一个表格。 有谁可以帮我这个? p> div>

php is a server side scripting language. You can do it with jquery. here a demo jsfiddle shows modal popup. Please go through it.

<!-- Button trigger modal -->
<button class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal">
  Launch demo modal
</button>

<!-- Modal -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
        <h4 class="modal-title" id="myModalLabel">Modal title</h4>
      </div>
      <div class="modal-body">
        ...
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
        <button type="button" class="btn btn-primary">Save changes</button>
      </div>
    </div>
  </div>
</div>

PHP is a server side language and does not run in the browser. You will want to look into javascript. If you are new to javascript and you want to get basic functionality up quickly, jQuery is the way to go!

$('button').on('click', function() {
  alert('hello world');
});

Some useful resources:

https://developer.mozilla.org/en-US/docs/Web/JavaScript/A_re-introduction_to_JavaScript http://learn.jquery.com/about-jquery/how-jquery-works/

PhP cannot open popups... for that you need to use html or javascript

if you are using a css framework its easier (like bootstrap)

http://getbootstrap.com/javascript/#modals

You can used jQuery dialog instead.

<script>
<!-- Call jQuery Class -->

$('#opener').click(function() {
        $('#dialog').dialog('open');
        return false;
});
</script>

<div id = "dialog" title = "Search">
     <form action = "" method = "post" id = "form" name = "form">
        <!-- Contents -->
      </form>
</div>

<input type = "button" name = "opener" value = "Open Me" id = "opener">

You can't open popup using PHP. You can do this with colorbox and fancybox.