Jquery 在页面退出时添加引导模式窗体
当用户想要退出页面时,有没有办法在joomla 3.0中显示引导表单? 我正在尝试添加位置最靠近页脚的自定义html页面。 当我尝试测试此功能时,我面临一个错误: 1:`TypeError:无法读取null的属性'modal' 下面是自定义html模块中的代码Jquery 在页面退出时添加引导模式窗体,jquery,twitter-bootstrap,joomla,Jquery,Twitter Bootstrap,Joomla,当用户想要退出页面时,有没有办法在joomla 3.0中显示引导表单? 我正在尝试添加位置最靠近页脚的自定义html页面。 当我尝试测试此功能时,我面临一个错误: 1:`TypeError:无法读取null的属性'modal' 下面是自定义html模块中的代码 <div id="myModal" class="modal fade"> <div class="modal-dialog"> <div class="modal-content"&g
<div id="myModal" class="modal fade">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title">Contact Form</h4>
</div>
<div class="modal-body">
<form role="form" action="" method="post" >
<div class="col-lg-12">
<div class="form-group">
<label for="InputName">Name</label>
<div class="input-group">
<input type="text" class="form-control" name="InputName" id="InputName" placeholder="Enter Name" required>
<span class="input-group-addon"><i class="glyphicon glyphicon-ok form-control-feedback"></i></span></div>
</div>
<div class="form-group">
<label for="InputEmail"> e-mail</label>
<div class="input-group">
<input type="email" class="form-control" id="InputEmail" name="InputEmail" placeholder="Enter Email" required >
<span class="input-group-addon"><i class="glyphicon glyphicon-ok form-control-feedback"></i></span></div>
</div>
<div class="form-group">
<label for="InputMessage">Message</label>
<div class="input-group">
<textarea name="InputMessage" id="InputMessage" class="form-control" rows="5" required></textarea>
<span class="input-group-addon"><i class="glyphicon glyphicon-ok form-control-feedback"></i></span></div>
</div>
<input type="submit" name="submit" id="submit" value="Wyślij" class="btn btn-info pull-right">
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Zamknij</button>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<script type='text/javascript'>
function goodbye(e) {
if(!e) e = window.event;
//e.cancelBubble is supported by IE - this will kill the bubbling process.
$('#myModal').modal('show');
e.cancelBubble = true;
e.returnValue = 'You sure you want to leave?'; //This is displayed on the dialog
$('#test').show();
//e.stopPropagation works in Firefox.
if (e.stopPropagation) {
e.stopPropagation();
e.preventDefault();
}
}
window.onbeforeunload=goodbye;
</script>
&时代;
联系方式
名称
电子邮件
消息
赞克尼
功能(e){
如果(!e)e=window.event;
//e、 IE支持cancelBubble-这将终止冒泡过程。
$('myModal').modal('show');
e、 取消气泡=真;
e、 returnValue='确实要离开吗?';//这将显示在对话框上
$('#test').show();
//e、 stopPropagation在Firefox中工作。
如果(如停止播放){
e、 停止传播();
e、 预防默认值();
}
}
window.onbeforeunload=再见;
有没有办法只显示模式而不显示浏览器的警告消息?请确保包含引导框架(我相信您已经有了) 我认为在调用show方法之前,还需要将html元素初始化为modal
$('#myModal').modal({'show':true});
请参见此处的示例:
还有,测试的目的是什么
更多信息: