html5怎么实现定时关闭自身页面

html-css07

html5怎么实现定时关闭自身页面,第1张

要用js 比如要3秒后关闭

<script>

setTimeout(function(){

window.close()}

, 3000 )

</script>

楼主好,html5怎么实现这个不清楚,但是js可以解决

关闭页面时,弹出JS提示框提示是否关闭

JQUERY写法:

$(window).bind('beforeunload', function (e) {

var isEdit = '<%=FormMastPage.ViewMode%>'

if (window.is_confirm !== false &&isEdit == Enumerator.ItemViewMode.AllEdit) {

var message = '<%=this.GetRes("Msg_CheckPageEditMode")%>'

e.returnValue = message

}

})

.bind('mouseover mouseleave', function (event) {

is_confirm = event.type == 'mouseleave'

})

JAVASCRIPT写法:

window.onbeforeunload = function (event) {

var event = event || window.event

// 兼容IE8和Firefox 4之前的版本

if (event) {

event.returnValue = "确定要关闭窗口吗?"

}

// Chrome, Safari, Firefox 4+, Opera 12+ , IE 9+

return '确定要关闭窗口吗>现代浏览器?'

}