【发布时间】:2022-12-02 08:47:46
【问题描述】:
I'm new on HTML and I need to understand some basic stuff for a project with the ESP01 wi-fi module. I would like to create a web page with a button and this one has to have a different behaviour according to if it is pressed or released.
I tried with this
<button onclick='location.href='/UP_ON'' onmouseup='location.href='/UP_OFF''>UP</button>
but it doesn't work.
【问题讨论】:
-
There is an
onmousedownevent... Of course, if it does the same thing asonclick, theonmouseupmay never fire because you're changinglocation.href, causing the browser to reload the page....