when I click a button, this sum "max clicks + 1" when it reaches 5, this fails and stops.
Forum



JavaScript HLP
14 replies



when I click a button, this sum "max clicks + 1" when it reaches 5, this fails and stops.
1
maxclicks = maxclick + 1;
1
maxclicks = maxclicks + 1;

works, but that no stop when reach the limit
1
if (maxclicks < 5) {
1
maxclicks = maxclick + 1;

1
2
3
4
5
6
7
8
9
10
11
12
13
2
3
4
5
6
7
8
9
10
11
12
13
function gen(){ var maxclicks = ""; var msclicks = 0; if (maxclicks < 5) { var obt = document.getElementById("hue") var pri = repeater(); var seg = repeater(); var ter = repeater(); var ptm = pri + "-" + seg + "-" + ter; obt.innerHTML = ptm; maxclicks = msclicks + 1; } }
send me a mp
how i can show points of users ?
1
<li><a href="./points.php">Points $points["user_id"]</a></li>

1
<?= $points["user_id"] ?>
1
<?php echo $points["user_id"]; ?>
Also:
1
2
3
4
5
6
7
8
9
10
11
12
2
3
4
5
6
7
8
9
10
11
12
var maxclicks = 0; var obt = document.getElementById("hue"); function gen() { 	if (maxclicks < 5) { 		var ptm = repeater() + "-" + repeater() + "-" + repeater(); 		obt.innerHTML = ptm; 		maxclicks++; 	} else { 		alert("nope."); 	} }
hueit's best to call
document.getElementById()once instead of each time. It only saves like half a millisecond but still

And to be honest you would be better disabling the click of the element instead of it still calling the function each time.
edited 2×, last 21.07.16 09:27:01 am
1
<li><a href="./stats.php">Points <?php echo (!isset($points));?></a></li>
on my database . Points = 5
but on my web only show 1 for all users...


Why are you using isset? Change your database structure and give
pointsa default value of 0 then you should never have to unless you use the same code for another database table, which is highly unlikely.
Show us your code which requests the point count.
edited 1×, last 21.07.16 11:18:32 pm
who i can change ??

INT
VARCHAR
TEXT
DATE
password type selected : VARCHAR

edited 1×, last 22.07.16 09:55:22 am



