我想使用jQuery在模式dailog框内的“Login”和“Sign_Up”按钮之间放置一个文本。怎么做? 而且,如何将一些锚标签与这些按钮链接? 这是我的代码片段: 任何帮助将不胜感激,谢谢。
<!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>
答案 0 :(得分:0)
您可以尝试添加自定义按钮并根据需要更改其样式。代码:
链接: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" />