Categories
JavaScript

Switch Statement in JavaScript

A simple program that I wrote using the JavaScript programming language to show how to use the switch statement.

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 in 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.
My telephone number at home here in Bacolod City, Negros Occidental Philippines is  +63 (034) 4335675.


Here in Bacolod City, Negros Occidental I also accepting computer repair, web development using WordPress, Computer Networking and Arduino Project development at a very affordable price.


My personal website is http://www.jakerpomperada.comMy programming website is http://www.jakerpomperada.blogspot.com


I am also a book author you can purchase my books on computer programming and information technology in the following links below.
https://www.mindshaperspublishing.com/
https://www.unlimitedbooksph.com/

Sample Program Output

Program Listing

index.htm


<html>
 <head>
  <title>Switch Statement in JavaScript </title>
 </head>
 <body>
  <script type="text/javascript">
a=1;
document.write("The given year level is " +a);


switch (a) {
  case 1:
     alert("You are belong first year");
     break;
  case 2:
     alert("You are belong second year");
     break;
  case 3:
     alert("You are belong third year");
     break;
  case 2:
     alert("You are belong fourth year");
     break;
     
  default:
     alert("Invalid Year Level. Try Again");
}
</script>
 </body>
 </html>
Categories
JavaScript

Kilogram To Ounce Converter in JavaScript

I wrote this program to ask the user to give kilogram value and then it will convert into ounce weight equivalent 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 in 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.

My telephone number at home here in Bacolod City, Negros Occidental Philippines is  +63 (034) 4335675.
Here in Bacolod City, Negros Occidental I also accepting computer repair, networking and Arduino Project development at a very affordable price.


My personal website is http://www.jakerpomperada.com

My programming website is http://www.jakerpomperada.blogspot.com

I am also a book author you can purchase my books on computer programming and information technology in the following links below.
https://www.mindshaperspublishing.com/https://www.unlimitedbooksph.com/

Sample Program Output

Sample Program Output

Program Listing

index.html

<html>
  <head>
   <title>Kilogram To Ounce Converter in JavaScript</title>
  </head>
  <body>
  	 <style>
      body {
       font-family: arial;
       font-size: 20px;
       font-weight: bold;
      }
   </style>
<script type="text/javascript">
   function forward() {
      with (document.convert) {
	 unit1.value = unit1.value.toString().replace(/[^\d\.eE-]/g,'');
	 if (unit1.value/0.0252 != 0) {
	    unit2.value = (unit1.value/0.0252).toFixed(2);
	 }
      }
   }
   function backward() {
      with (document.convert) {
	 unit2.value = unit2.value.toString().replace(/[^\d\.eE-]/g,'');
	 if (unit2.value*0.0252 != 0) {
	    unit1.value = (unit2.value*0.0252).toFixed(2);
	 }
      }
   }
</script>

<h4></h4>
<noscript><p><font color="red"><strong>Please enable Javascript
to use the unit converter</strong></font></p></noscript>
<form name="convert" style="font-size:1.3em;border:solid 1px #B7D7AF;border-radius:7px;background-color:#EEEEEE;margin-right:10px;padding-left:10px;padding-right:10px">
<br />
<tr>
<td><strong>Kilogram To Ounce Converter in JavaScript</strong></td></tr>
<table border="0" cellpadding="7" cellspacing="0">

<tr>
	<td><input type="number" step="0.1" name="unit1" style="width:200px;font-size:1em" onchange="forward()" value=""></td><td><strong>Kilogram</strong></td></tr>
<tr><td><input type="number" step="0.1" name="unit2" style="width:200px;font-size:1em" onchange="backward()" value=""></td><td><strong>Ounce</strong></td></tr>
<tr><td><input type=button value="Convert" style="font-size:1em;margin-bottom:15px" onclick="forward()"></td></tr></table>
</form>
</body>
</html>
Categories
JavaScript

Product of Two Numbers in JavaScript

I wrote this program using JavaScript to ask the user to give two numbers and then the program will compute the product of two numbers and display the results using an alert dialog box in JavaScript.

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 in 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.My telephone number at home here in Bacolod City, Negros Occidental Philippines is  +63 (034) 4335675.


Here in Bacolod City, Negros Occidental I also accepting computer repair, networking and Arduino Project development at a very affordable price.


My personal website is http://www.jakerpomperada.com

My programming website is http://www.jakerpomperada.blogspot.com

I am also a book author you can purchase my books on computer programming and information technology in the following links below.
https://www.mindshaperspublishing.com/

https://www.unlimitedbooksph.com/

Sample Program Output
Sample Program Output

Program Listing

index.html

<html>
  <head>
   <title>Product of Two Numbers in JavaScript</title>
  </head>
  <style>
      body {
       font-family: arial;
       font-size: 20px;
       font-weight: bold;
      }
   </style>
  <body>
  	
<script>
function product(){
var num1=document.form.text1.value;
var num2=document.form.text2.value;
var sum=Number(num1)*Number(num2);
alert("The product between " + num1 + " and " + num2 + " is " + sum + ".");
}
</script>
<form name="form"><br>
	<h4>Product of Two Numbers in JavaScript</h4>
<table>
<tr>
<td>Enter First Number:</td>
<td><input type="text" name="text1"></td>
</tr>
<tr>
<td>Enter Second Number:</td>
<td><input type="text" name="text2"></td>
</tr>
<tr>
<tr></tr><tr></tr>
<td><input type="button" value="Solve For Product" onclick="product();"></td>
</tr>
</table>
</body>
</html>