Welcome, Guest |
You have to register before you can post on our site.
|
Online Users |
There are currently 1034 online users. » 0 Member(s) | 1032 Guest(s) Bing, Yandex
|
Latest Threads |
SELECT statement with MS ...
Forum: MS Access SQL Tutorials
Last Post: Qomplainerz
07-27-2023, 03:35 PM
» Replies: 0
» Views: 1,080
|
SELECT statement with the...
Forum: MS Access SQL Tutorials
Last Post: Qomplainerz
07-27-2023, 03:31 PM
» Replies: 0
» Views: 529
|
Creating hyperlinks in HT...
Forum: HTML5 Tutorials
Last Post: Qomplainerz
07-27-2023, 01:23 PM
» Replies: 0
» Views: 829
|
What's new in HTML5?
Forum: HTML5 Tutorials
Last Post: Qomplainerz
07-27-2023, 12:48 PM
» Replies: 0
» Views: 555
|
What is HTML5?
Forum: HTML5 Tutorials
Last Post: Qomplainerz
07-27-2023, 12:43 PM
» Replies: 0
» Views: 520
|
Neck isometric exercises
Forum: Exercises
Last Post: Qomplainerz
07-27-2023, 11:44 AM
» Replies: 0
» Views: 811
|
Shoulder shrug
Forum: Exercises
Last Post: Qomplainerz
07-27-2023, 11:43 AM
» Replies: 0
» Views: 476
|
Neck retraction
Forum: Exercises
Last Post: Qomplainerz
07-27-2023, 11:43 AM
» Replies: 0
» Views: 438
|
Neck flexion and extensio...
Forum: Exercises
Last Post: Qomplainerz
07-27-2023, 11:42 AM
» Replies: 0
» Views: 506
|
Neck rotation
Forum: Exercises
Last Post: Qomplainerz
07-27-2023, 11:42 AM
» Replies: 0
» Views: 478
|
|
|
JavaScript exercises and solutions - Identify if a number is odd or even |
Posted by: Qomplainerz - 04-04-2023, 07:56 AM - Forum: JavaScript Tutorials
- No Replies
|
|
The HTML part between the <body></body> tags looks like this:
Code: Please enter a number here:
<br>
<input type="Text" id="Num1">
<br>
<input type="button" id="submit" value="submit" onclick="oddOrEven()"></input>
<p id="Output"></p>
<input type="button" id="reset" value="Reset" onclick="Reset()"></input>
The JavaScript part looks like this:
Code: function oddOrEven()
{
Num1 = document.getElementById("Num1").value;
if(Num1 % 2 == 0)
{
document.getElementById("Output").innerHTML = "Even";
}
else
{
document.getElementById("Output").innerHTML = "Odd";
}
}
function Reset()
{
document.getElementById("Num1").value = "";
document.getElementById("Output").innerHTML = "";
}
|
|
|
|