HLJ 发布于
2023-06-17 10:19:32
39阅读

JavaScript onhashchange事件当哈希值变动时触发

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body onhashchange="myFn()">
    <a href="#123">123</a>
    <a href="#456">456</a>
</body>

</html>
<script>
    function myFn() {
        console.log('good1230.com')
    }
</script>
当前文章内容为原创转载请注明出处:http://www.good1230.com/detail/2023-06-17/630.html
最后生成于 2024-06-22 12:07:40
此内容有帮助 ?
0