duanji7881
duanji7881
2014-09-10 04:53
浏览 100

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

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

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

5条回答 默认 最新

  • doulang5323
    doulang5323 2014-09-10 05:00
    已采纳

    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>
    
    点赞 评论
  • douchen2025
    douchen2025 2014-09-10 04:57

    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/

    点赞 评论
  • dou11655853
    dou11655853 2014-09-10 04:59

    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

    点赞 评论
  • duanfengdian7014
    duanfengdian7014 2014-09-10 05:02

    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">
    
    点赞 评论
  • dsxcv5652
    dsxcv5652 2014-09-10 05:05

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

    点赞 评论

相关推荐