如何在jQuery的模态对话框的按钮之间放置文本
How to put a text in between the buttons inside a modal dialog box in jQuery?
我想在按钮"Login"answers"Sign_Up"之间使用jQuery的模态dailog框。怎么做呢?并且,我如何将一些锚标签与这些按钮链接起来?下面是我的代码片段:如有任何帮助,不胜感激,谢谢。
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>jQuery UI Dialog - Default functionality</title>
<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.9.2/themes/ui-darkness/jquery-ui.css" rel="stylesheet">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.9.2/jquery-ui.min.js"></script>
<script type="text/javascript">
$(function () {
$("#dialog_nav").dialog({
autoOpen: false,
modal: true,
dialogClass: "First_Dialog",
resizable: false,
buttons: {
"Login": function () {
$(this).dialog("close");
},
"SignUp": function () {
$(this).dialog("close");
}
}
});
$("#Dialog_Modal").on("click", function (event) {
$("#dialog_nav").dialog("open");
});
});
</script>
<style type="text/css">
.First_Dialog .ui-dialog-titlebar{
display:none;
}
.First_Dialog .ui-dialog-titlebar-close{
display:none;
}
</style>
</head>
<body>
<div id="dialog_nav" title="Basic dialog">
<p>This is the default dialog which is useful for displaying information. The dialog window can be moved, resized and closed with the 'x' icon.</p>
</div>
<input type="button" id="Dialog_Modal" value="Click to open a modeless dialog" />
</body>
</html>
您可以尝试添加自定义按钮并根据您的需要更改其样式。代码:
链接:http://jsfiddle.net/lotusgodkk/GCu2D/69/
Javascript:$(function () {
$("#dialog_nav").dialog({
autoOpen: false,
modal: true,
dialogClass: "First_Dialog",
resizable: false,
buttons: [{
text: "Cancel",
"class": 'cancelButtonClass',
click: function () {
// Cancel code here
}
}, {
text: "Custom",
"class": 'custom',
click: function () {
// code here
}
}, {
text: "Cancel",
"class": 'cancelButtonClass',
click: function () {
// Cancel code here
}
}, ],
});
$("#Dialog_Modal").on("click", function (event) {
$("#dialog_nav").dialog("open");
});
});
HTML: <div id="dialog_nav" title="Basic dialog">
<p>This is the default dialog which is useful for displaying information. The dialog window can be moved, resized and closed with the 'x' icon.</p>
</div>
<input type="button" id="Dialog_Modal" value="Click to open a modeless dialog" />
相关文章:
- 使用javascript单击同一按钮,在两种样式之间更改css值
- 在我的Javascript和HTML之间的表单提交按钮链接中遇到问题
- jQuery - 在按钮之间切换
- JQuery ajax在2个按钮之间切换's类具有2次单击事件,但无法更改按钮的值
- 在按钮之间添加隐藏空间
- .click() 和实际单击按钮之间的区别?(javascript/jQuery)
- click.funcion 和 bootstraps 的轮播按钮之间的冲突
- 使用 jQuery 在两个按钮之间切换
- 使用KnockoutJS在添加/删除按钮之间切换
- 在两个单选按钮之间切换
- 3个按钮之间的交互
- 在表单操作与复选框或单选按钮之间交替进行
- 如何在单选按钮之间自动切换
- 如何在单选按钮之间建立关系
- 如何在jQuery的模态对话框的按钮之间放置文本
- 建立开关按钮之间的关系
- 如何在jQuery对话框中的两个按钮之间垂直居中对齐文本
- 选择两个按钮时选择多个按钮(必须选择位于两个按钮之间的按钮)
- 我想为一个网站添加按钮之间的空间(也许它被称为空白)
- 使用javascript在2个按钮之间添加水平空间