调用JS函数

<!DOCTYPE html>
<html>

<head>
    <script type="text/javascript">
        fn = function () {
            alert('123');
        }
    </script>
</head>

<body onclick="fn()" style="width: 100vw;height: 100vh;background-color: blueviolet;">
    <a href="javascript:void(0);" onclick="fn()">what</a>
</body>

</html>
发布了50 篇原创文章 · 获赞 11 · 访问量 1万+

猜你喜欢

转载自blog.csdn.net/qq_35689096/article/details/104069314