我正在使用模态引导程序,并且在执行弹出窗口上的window.print
后无法打开它。当我取消打印时,会显示模态引导程序。
这只发生在Chrome中。
这是我们可以模拟单击按钮"OpenPopup"
并按下"OpenModal"
按钮的代码:
<html>
<head>
<script type="text/javascript" src="http://luissantana.com.br/pdv/themes/default/assets/js/jquery-2.0.3.min.js"></script>
<script type="text/javascript" src="http://luissantana.com.br/pdv/themes/default/assets/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="http://luissantana.com.br/pdv/themes/default/assets/styles/theme.css" type="text/css">
<script type="text/javascript">
function Popup(data) {
var mywindow = window.open('', 'sma_pos_print', 'height=500,width=300');
mywindow.document.write('<html><head><title>Print</title>');
mywindow.document.write('</head><body>');
mywindow.document.write(data);
mywindow.document.write('</body></html>');
mywindow.print();
mywindow.close();
return true;
}
function onClickOpenPopup() {
Popup('teste');
}
function onClickOpenModal() {
$('#susModal').modal();
}
</script>
</head>
<body>
<input type="button" onclick="onClickOpenPopup();" value="OpenPopup" class="botao"/>
<input type="button" onclick="onClickOpenModal();" value="OpenModal" />
<div class="modal fade in" id="susModal" tabindex="-1" role="dialog" aria-labelledby="susModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true"><i
class="fa fa-2x">×</i></button>
<h4 class="modal-title" id="susModalLabel">TESTE</h4>
</div>
<div class="modal-body">
<p>Teste</p>
<div class="form-group">
asdasdasd
</div>
</div>
<div class="modal-footer">
<button type="button" id="suspend_sale" class="btn btn-primary">Submit</button>
</div>
</div>
</div>
</div>
</body>
</html>