我想在JAVASCRIPT中按钮点击事件的弹出窗口中打开表格。有人能帮我吗??
<!-- 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">×</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无法打开弹出窗口。。。为此,您需要使用html或javascript
如果你使用的是css框架,它更容易(像引导程序)
http://getbootstrap.com/javascript/#modals
PHP是一种服务器端语言,不在浏览器中运行。您将需要研究javascript。如果您是javascript新手,并且希望快速掌握基本功能,那么jQuery就是您的选择!
$('button').on('click', function() {
alert('hello world');
});
一些有用的资源:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/A_re-introduction_to_JavaScripthttp://learn.jquery.com/about-jquery/how-jquery-works/
您可以使用jQuery对话框。
<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">
您不能使用PHP打开弹出窗口。你可以用colorbox和fancybox来做到这一点。