Javascript 在php中按钮的单击事件的弹出窗口中打开一个表单
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/25757536/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Open A Form in popup window on button's click event in php
提问by Nishith Adhvaryu
I want to open A Form in popup window on button's click event in JAVASCRIPT. can anybody help me about this??
我想在 JAVASCRIPT 中按钮的单击事件的弹出窗口中打开一个表单。有人可以帮我解决这个问题吗??
回答by Lal krishnan S L
php is a server side scripting language. You can do it with jquery. here a demo jsfiddleshows modal popup. Please go through it.
php 是一种服务器端脚本语言。你可以用 jquery 做到这一点。这里的演示jsfiddle显示了模态弹出窗口。请通过它。
<!-- 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>
回答by Shudmeyer
You can used jQuery dialog instead.
您可以改用 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">
回答by Kausha Mehta
You can't open popup using PHP. You can do this with colorbox and fancybox.
您无法使用 PHP 打开弹出窗口。你可以用colorbox和fancybox来做到这一点。
回答by alexreardon
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, jQueryis the way to go!
PHP 是一种服务器端语言,不能在浏览器中运行。你会想要研究 javascript。如果您不熟悉 javascript 并且想快速获得基本功能,那么jQuery是您的不二之选!
$('button').on('click', function() {
alert('hello world');
});
Some useful resources:
一些有用的资源:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/A_re-introduction_to_JavaScripthttp://learn.jquery.com/about-jquery/how-jquery-works/
https://developer.mozilla.org/en-US/docs/Web/JavaScript/A_re-introduction_to_JavaScript http://learn.jquery.com/about-jquery/how-jquery-works/
回答by Chico3001
PhP cannot open popups... for that you need to use html or javascript
PhP 无法打开弹出窗口...为此您需要使用 html 或 javascript
if you are using a css framework its easier (like bootstrap)
如果您使用的是 css 框架,则它更容易(如引导程序)

