The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

> Counter minimum, new in the html and all other code
Osku
post Mar 3 2020, 02:23 PM
Post #1





Group: Members
Posts: 3
Joined: 3-March 20
Member No.: 27,217



Hello! I am new to all code and studying some beginner course atm.

So, I want to add a strip of code that doesn't allow negative values in the printed out text.
Here is what I have so far.

<html>

<head>
<center>
<meta charset="utf-8"/>
<title>Pressavaali laskuri</title> Äänilaskuri

<br>
<br>
<nav>
</head>
<body>
<button type="button" onclick="lisaa();"> lisää äänen </button> click to vote <!the first button increases the the total value.>
<br>

<button type="button" onclick="vahenna();"> vähentää äänen </button> click to veto <!the second button decreases the the total value.>

<h1 id="laskuri1"> 0 </h1>
<script>
var clicks = 0;
function lisaa(){
clicks++;
document.getElementById("laskuri1").innerHTML = clicks; //// +1 votes

}
function vahenna(){
clicks--
document.getElementById("laskuri1").innerHTML = clicks; //// -1 votes
}
</script>
</body>
</center>
</html>


I'd appreciate any help, I am kinda lost here, couldn't find this info, due the lack of knowledge in search words laugh.gif
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Posts in this topic
Osku   Counter minimum   Mar 3 2020, 02:23 PM
Christian J   Here's one idea: <button type="butto...   Mar 3 2020, 03:49 PM
Osku   Thank you Christian for tips and help. I am going ...   Mar 4 2020, 09:52 AM


Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 14th July 2020 - 11:22 AM