Why is the onclick event on the body element not working?(为什么 body 元素上的 onclick 事件不起作用?)
问题描述
我试图在点击 html 正文时将用户发送到另一个页面:
I'm trying to send users to another page when click html body:
JavaScript c.js
:
JavaScript c.js
:
HTML:
我可以从控制台运行该功能,但单击 <body>
不起作用.
I can run the function from console, but clicking the <body>
is not working.
推荐答案
<body>
元素没有高度.添加如下代码:
The <body>
element has no height. Add something like the code below:
这篇关于为什么 body 元素上的 onclick 事件不起作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!