For how to achieve? Button code

I want to make a webpage, a button middle button is webpage, picture, and then the bottom has a number, press the button numbers since the increase of 1, is how many points the button statistics. How to realize the?

Started by Roger at February 09, 2016 - 7:26 PM

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Untitled Document</title>
<script>
var num=0;
function bitNum(){
		num++;
		document.getElementById("bitnum").innerHTML=num;
	}
</script>
</head>
<body>
<div>
	<input type="button" class="imgbtn" onClick="bitNum()">
    <label id="bitnum"></label>
</div>
</body>
</html>

Posted by Cliff at February 13, 2016 - 8:18 PM

But the number of refresh gone ah, if you save it, should be placed into a TXT file or save in the database.

Posted by Cliff at November 18, 2016 - 2:16 PM

#1 only the statistics of a visitor yourself many times, the server statistics.

So many people "statistics......" Is the server program

Posted by Jeffery at November 20, 2016 - 3:06 PM

+1

Posted by Beacher at December 05, 2016 - 3:24 PM

<script>
 $(funcion{
   var count = 0;
   $("imgbtn").click(function(){
    $.post(
      CountServlet,
      num:$("bitnum").val(),
      fucntion(data,status){
         // alert("The number of saved successfully´╝ü");
         $("bitnum").html(count++);
    }
 );
});


});
</script>
<body>
<div>
    <input type="button" class="imgbtn">
    <label id="bitnum"></label>
</div>
</body>

After the servlet receiving and processing of your num.

Posted by Basil at December 12, 2016 - 3:36 PM

CountServlet:
//String into int
 int count = Integer.parseInt(request.getParameter("num"));
 //The operation of the count
 //If you want to do the statistics, can be put in the database.

Posted by Basil at December 24, 2016 - 4:15 PM

+1

Posted by Terence at January 01, 2017 - 6:01 PM

Posted by Nick at January 05, 2017 - 5:14 PM

This post will be staring at your brother, or knot paste, brother.

Posted by Darren at January 14, 2017 - 6:28 PM