html>
<html>
<head>
<meta charset="utf-8">
<title>title>
<script type="text/javascript">
function bxh(){
alert("没有诚意!88");
}
script>
head>
<body>
<h1>你喜欢我吗h1>
<input type="button" value="不喜欢" onclick="bxh()">
<input type="button" value="喜欢" onclick="xh()"/>
body>
html>
参考如下:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<h1>你喜欢我吗</h1>
<input type="button" value="不喜欢" onclick="bxh()">
<input type="button" value="喜欢" id="unlike" onclick="xh" style="position:absolute; "/>
<script type="text/javascript">
function bxh(){
alert("没有诚意!88");
}
document.getElementById("unlike").addEventListener("mouseenter", function () {
let mobiletop = Math.round(Math.random() * 90);
let mobileLeft = Math.round(Math.random() * 90);
document.getElementById("unlike").style.top = mobiletop + "%";
document.getElementById("unlike").style.left = mobileLeft + "%";
})
</script>
</body>
</html>
xh() 这个函数在哪呢,有没有呢?贴出来看一下
什么叫随机跑?满屏幕乱跑的吗?鼠标追不上的吗?要瞬移吗?