Categories
JavaScript

Odd and Even Number Checker in JavaScript

 A simple program that I wrote to ask the user to give a number and then the program will check if the given number is odd or even number using JavaScript programming language.I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me at the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.

My email address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com

<!DOCTYPE html>
<html> 
<head>
<meta charset=utf-8 />
<title>Odd and Even Number Checker in JavaScript </title>
<style type="text/css">
html {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background: #fff;
    color: #000;
    height: 100%;
    min-height: 100vh;
    overflow-y: auto;
    padding: 100px 0;
    text-align: center;
    font-family: sans-serif;
}

h1:nth-of-type(1) {
    font-size: 35px;
    line-height: 35px;
    margin: 0 0 15px;
}

h2:nth-of-type(1) {
    margin: 0 0 35px;
}

h2:nth-of-type(2) {
    margin: 30px 0 20px;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 30px;
}

a,
input[type="submit"] {
    margin: 0 0 35px;
    color: #fff;
    text-decoration: none;
    padding: 15px 20px;
    border-radius: 10px;
    min-width: 150px;
    background: #3CBB9E;
    display: inline-block;
    text-transform: uppercase;
    border: none;
    outline: none;
    font-size: 15px;
}

a:hover,
input[type="submit"]:hover {
    opacity: 0.8;
    color: #fff;
    cursor: pointer;
}

a:nth-of-type(1) {
    margin-right: 8px;
}

a:nth-of-type(2) {
    margin-left: 8px;
}

table {
    margin: 0 auto;
    border-collapse: collapse;
    border: 1px solid #000;
}

thead td {
    text-transform: uppercase;
    font-weight: 700;
    background: #00334B;
    color: #f2f2f2;
}

tbody tr {
    background: #fff;
    border-bottom: 1px solid #00334B;
    color: #666666;
}

td {
    padding: 20px;
}

table a,
table a:hover {
    border-radius: 5px;
    min-width: 80px !important;
    padding: 10px !important;
    margin: 0 !important;
}

table tr td:nth-child(4) a {
    background: #2b86c5 !important;
}

table tr td:nth-child(5) a {
    background: #784ba0 !important;
}

table tr td:nth-child(6) a {
    background: #ff3cac !important;
}

p,
label,
input[type="text"] {
    font-size: 15px;
    margin-bottom: 10px;
}

p {
    font-size: 20px;
}

label {
    width: 200px;
    display: inline-block;
    padding: 15px 0;
    background: #3CBB9E;
    color: #fff;
    border-top-left-radius: 30px;
    border-bottom-left-radius: 30px;
    text-transform: uppercase;
    font-size: 15px;
}

input[type="number"] {
    border: 0;
    outline: none;
    padding: 15px 20px;
    width: 250px;
    border-top-right-radius: 10px;
    border-bottom-right-radius: 10px;
    font-size: 15px;
    background: #eaeaea;
}

form {
    display: block;
    width: 350px;
    margin: 0 auto;
}

input[type="submit"] {
    width: 100%;
    font-size: 15px;
}

h1 {
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #f5f5f5;
    background: #009688;
    padding: 15px;
    border-radius: 10px;
    margin: 0;
    line-height: 30px;
    font-size: 35px;
}

</style> 
</head>
<body>
    <h1>Odd and Even Number Checker in JavaScript</h1>
    <script>
        function isEven() {

       //get the input value
             var num = document.getElementById('Val_Num').value;
	if (num%2 == 0)
		
        alert("The given number " + num +  " is even number");
	else
    alert("The given number " + num + " is odd number");
}

function Clear_Text() {

 document.getElementById('Val_Num').value ="";
 document.getElementById('Val_Num').focus();
 

}

    </script>
<form>
<label>Give a Number </label> <input type="number" id="Val_Num" name="Val_Num"/><br>
<br>
<input type="submit" onClick="isEven()" Value="Check" />
<input type="submit" onClick="Clear_Text()" Value="Clear" />
</form>
</p>
</body>
</html>
Categories
JavaScript

Alert Method in JavaScript

 In this article, I will share with you how to declare and use the alert method using the JavaScript programming language.

I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me at the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.

My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.

Program Listing

<html>
 <head>
  <title> Alert Method in JavaScript </title>
</head>
   <body>
    <script>
    	alert("This is an Alert Method in Javascript");
    </script>
 </body>
 </html>