我正在尝试设置一个模态,使用引导错误或成功的消息,但它没有被触发?如果所有的字段都填好了,电子邮件将发送(没有成功的消息),如果一个或多个字段是空的,电子邮件不会发送(没有成功的消息)?您可以在这里看到表单:
这个网站是一个正在进行的工作,我是新的所有这些引导!
我错过了什么?
这是html &触发脚本:
<div class="row">
<div class="span8">
<div id="formMode" class="modal fade">
<div class="modal-header"></div>
<div class="modal-body"></div>
<div class="modal-footer"></div>
</div>
<form action="contact.php" method="POST" id="contactform" class="form-horizontal">
<fieldset>
<legend>Please fill in the form bellow and a sales representive will be in contact swiftly.</legend>
//form details
</div>
</fieldset>
</form>
</div>
</div>
<script type="text/javascript">
$(document).ready(function () {
var mode_value = getQuerystring('mode');
switch (mode_value) {
case '':
$('#formMode').modal('hide');
break
case 'POST':
$('.modal-header').html('h1>Form submitted...</h1>');
$('.modal-body').html('<h2>Everything <em>seemed</em> to be correct.</h2>');
$('.modal-footer').html('<a href="#" class="btn" data-dismiss="modal">Close</a>');
$('#formMode').modal('show');
break
case 'success':
$('.modal-header').html('');
$('.modal-body').html('<div class="alert alert-block alert-success"><h4 class="alert-heading">Your message was sent</h4>We will respond to you shortly</div>');
$('.modal-footer').html('<a href="index.html" class="btn btn-success" data-dismiss="modal">Close</a>');
$('#formMode').modal('show');
break
case 'fail':
$('.modal-header').html('');
$('.modal-body').html('<div class="alert alert-block alert-error"><h4 class="alert-heading">The message was not sent</div>');
$('.modal-footer').html('<a href="#" class="btn btn-danger" data-dismiss="modal">Close</a>');
$('#formMode').modal('show');
};
})
</script>
</div>
您必须将联系人表单中的脚本行设置在之后,放置在文档末尾,以便页面加载更快的脚本。