我想要一个弹出框,其中包含用户名、电子邮件id等信息。点击提交按钮和确定和取消按钮,用JAVA脚本进行确认。如何在单击"提交"按钮时为"新建"窗口编写JavaScript,用"确定"one_answers"取消"显示注册信息。
<script type="text/javascript">
if (confirm("Press 'OK' to leave, or 'Cancel' if you want to stay: "))
{
window.location="http://google.com";
}
else
{
<a href="javascript:history.go(-1)">Go back</a>
}
</script>
可以使用JQUERY UI
您可能需要检查中的ModalForm
$( "#dialog-form" ).dialog({
autoOpen: false,
height: 300,
width: 350,
modal: true,
buttons: {
"Create an account": function() {
var bValid = true;
allFields.removeClass( "ui-state-error" );
if ( bValid ) {
$( "#users tbody" ).append( "<tr>" +
"<td>" + name.val() + "</td>" +
"<td>" + email.val() + "</td>" +
"<td>" + password.val() + "</td>" +
"</tr>" );
$( this ).dialog( "close" );
}
},
Cancel: function() {
$( this ).dialog( "close" );
}
},
close: function() {
allFields.val( "" ).removeClass( "ui-state-error" );
}
});