javascript大虾请进,50分献上,非常急

来源:百度知道 编辑:UC知道 时间:2024/06/14 18:28:15
我现在在做一个javascript游戏,就是屏幕上有个盒子,之后鼠标要试着点到这个盒子。现在已经把这个部分做完了,现在只是要做一个那种数在一个游戏当中,鼠标总共点了多少次和鼠标有多少次碰到过盒子,之后鼠标点到之后所有归零,各位大虾可以帮帮忙吗。我现在在游戏里有两个窗口,一个写着number of clicks之后另外一个写着number of mouse go over the box,鼠标总共点了多少次是要到写着number of clicks的窗口里,之后鼠标有多少次碰到过盒子是到写着number of mouse go over the box的窗口里。我明天就要做完,各位帮帮忙吧,小妹谢谢了!
style type="text/css">
<!--
#Box {
position:absolute;
width:300px;
height:300px;
z-index:1;
left: 158px;
top: 133px;
background-color: #FF0000;
}

-->
</style>

<script>

var c=0;

function movebox(div){

var left = Math.floor(Math.random()*824);
var top = Math.floor(Math.random()*568);

div.style.left=left;
div.style.top=top;

}

function increase(x) {
// increases the clicks by 1

c=c+x;
if (c<0){
c=0;
}
document.forms[0].clicks.valu

帮你完成了,不知道是不是你想要的效果。
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/HTML4.01/loose.dtd">
<html>
<head>
<title> New Document </title>
<meta name="Author" content="">
<meta name="Keywords" content="">
<meta name="Description" content="">

<style type="text/css">
<!--
#Box {
position:absolute;
width:300px;
height:300px;
z-index:1;
left: 158px;
top: 133px;
background-color: #FF0000;
}
-->
</style>

<script>

var c=0;
var totalClick = 0;
var totalMouseOver = 0;

function movebox(div) {

var left = Math.floor(Math.random()*824);