php编程:Html5 返回事件监听代码-雪洁之家

Html5 返回事件监听代码

<!DOCTYPE html>
<html>
<meta name="viewport" content="width=device-width">
<script type="text/javascript">
    var count = 0 ;
    window.history.pushState(null, null, "#");
    window.addEventListener("popstate", function(e) {
        document.getElementById('logView').innerHTML = "click back counts is " + (++count)
    })
</script>
<body>
<p id="logView">test history listen</p>
</body>
</html>


by 雪洁 2018-05-18 05:27:33 250 views
我来说几句

相关文章