SlideShare una empresa de Scribd logo
1 de 37
Web Scripts Project
JavaScript and HTML Webpage Demo
By
Sunny Okoro
Table of Contents
INTRODUCTION.............................................................................................................................................2
ORDER SYSTEM .............................................................................................................................................3
ORDER SYSTEM CODES .................................................................................................................................8
PAYROLL CALCULATIONS ............................................................................................................................10
PAYROLL CALCULATION CODES ..................................................................................................................13
RESTAURANT SYSTEM.................................................................................................................................15
RESTAURANT SYSTEM CODES.....................................................................................................................18
SPORTS SYSTEM ..........................................................................................................................................25
SPORTS SYSTEM CODES ..............................................................................................................................32
INTRODUCTION
This document contains different web scripting small programs created in Java Scripts and HTML.
ORDER SYSTEM
Order.Html
SystemOrder.Html
ORDER SYSTEM CODES
Java Scripts & HTML Codes
****************metric.js file***************************************
// convert pounds into kilograms//
var Pounds = parseFloat(prompt ("Enter the number of pounds to be
converted into killograms. n", " "));
varkillograms = Pounds * 0.4536;
//I added the lb symbol for pounds display enterd by the user.
document.writeln("Pounds enterned is: " + Pounds + "lb" );
//I added the kg symbol for killograms result.
document.writeln("<p>killograms is: " + killograms + "Kg" );
*********order.js file***************************************************
// Get the input from the user//
var price = parseFloat(prompt ("What is the price of your order? No dollar
sign. n", " "));
var tax =parseFloat(prompt ("What is the percenntage of the sales tax of
your order? No percentage sign. n", " "));
//calculate the total price and total prince for the order enter
varFinaltax = tax /100;
varSalestax = price * Finaltax;
varFinalprice = price + Salestax ;
// Display the results back to the customer
document.write("<p> Order price entered: $ ");
document.writeln(price);
document.write("<p> Percentage of sales tax entered: ");
document.write( + tax + "%" );
document.write("<p> Calculated sales tax to : $");
document.write(Salestax);
document.write("<p> Total price calculated with tax: $");
document.write(Finalprice);
******************order.html**********************************
<?xml version = "1.0" encoding = "utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns = "http://www.w3.org/1999/xhtml">
<head>
<title> order java systems</title>
</head>
<body>
<script type = "text/javascript" src="order.js">
</script>
</body>
</html>
******************************systemorder.html************
<?xml version = "1.0" encoding = "utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns = "http://www.w3.org/1999/xhtml">
<head>
<title> order java systems</title>
</head>
<body>
<h1> Calculate book price</h1>
<script type = "text/javascript" src = "order.js">
</script><br/>
<h1> Metric Calculator </h1>
<script type = "text/javascript" src = "Metric.js">
</script><br/>
</body>
</html>
**************************************************************************
**
PAYROLL CALCULATIONS
PAYROLL CALCULATION CODES
*****payrollcalculation.js file**************************************
varnetPay = 0;
var gross = 0;
vartotalNet = 0;
vartotalGross = 0;
varnumEmp;
varhourlyRate = 0;
var rate;
var deduction = 0;
var MAX_HOURS = 80;
var FULL_HOURS = 40;
// get number of eployees from the user
numEmp = parseInt(prompt("Enter the number of employes? n", " "));
// calculate the hours worked.
for (varemp = 1; emp<= numEmp; emp++)
{
var hours = 0;
// Get the hours worked from the user.
hours = parseFloat(prompt ("Enter number of hours worked by
employee #" + emp + "n", " "));
while(hours < 0 || hours > MAX_HOURS){
hours = parseFloat(prompt ("Enter your hours worked.n
hours must be between 0 and "
+ MAX_HOURS + "
hours", " "));
}
if (hours < FULL_HOURS)
rate = .15;
else
rate = .30;
// Get the hourly rate from the user.
varhourlyRate = 0;
hourlyRate = parseFloat(prompt ("Enter employee #" + emp + "
hourly raten", " "));
// Validate the input by the user.
while (hourlyRate< 7.50 || hourlyRate> 15.00 )
{
hourlyRate = parseFloat(prompt ("Enter your hourly raten
Must be between 7.50 & 15.00", " "));
}
gross = hours * hourlyRate;
deduction = rate * gross;
netPay = gross - deduction;
totalNet += netPay;
totalGross += gross;
// print the results
document.write("<p>Employee #" + emp + " worked " + hours +
" hours at $" + hourlyRate + " per hour for gross pay of $" + gross
+ " and net pay of $" + netPay + " based on a tax rate of " + rate * 100 +
"%." );
}
document.write("<p> Total grosspay is $" + totalGross);
document.write("<p> Total netpay is $" + totalNet );
************************payrollcalculation.html***************************
<?xml version = "1.0" encoding = "utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns = "http://www.w3.org/1999/xhtml">
<head>
<title>Payroll Caclculator</title>
</head>
<body>
<h2>Payroll Calculations</h2>
<script type = "text/javascript" src =
"payrollcalculations.js">
</script>
</body>
</html>
RESTAURANT SYSTEM
RESTAURANT SYSTEM CODES
Java Scripts & Html Codes
<?xml version = "1.0" encoding = "utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns = "http://www.w3.org/1999/xhtml">
<!-- IST 350 LAB 16 -->
<head>
<title> ROSEHILL STAR RESTAURANT </title>
<script type = "text/javascript" src = "lab.js" >
</script>
</head>
<body>
<p><h1>ROSEHILL STAR RESTAURANT ORDER SYSTEM</h1></p>
<form name = "orderForm" action = " ">
<p>
<input type= "button" id = "submit" name = "submit" value
= "Submit Order" />
<input type = "reset" id = "Reset" value = "Clear Order"/>
</p>
<p> Please enter your initials </p>
<input type =" text" id = "name" name ="name" size="3" maxlength="3" />
<p> Please enter the discount rate without % sign </p>
<input type =" text" id = "discount" name ="discount" size="5"
maxlength="5" />
<p><h2>MENU</h2></p>
<p><h4>Main dish </h4></p>
<input type= "radio" name = "mainDish" id ="fchicken"
value=" FriedChicken" checked ="checked" /> Fried Chicken <br
/>
<input type = "radio" name ="mainDish" id = "chicken"
value="BakedChicken" /> Baked Chicken<br />
<input type = "radio" name ="mainDish" id ="Burger"
value= "Burger" onclick="handlemainDishBurgerclick();" />
Burger <br />
<p><h4>Side dish</h4></p>
<input type= "checkbox" name = "SideDish" id ="fries"
value=" fries" checked ="checked" /> French fries
<br />
<input type = "checkbox" name ="SideDish" id ="cake"
value="cake" /> Triple fudge cake <br />
<input type = "checkbox" name ="SideDish" id = "cream"
value= "cream" /> International Ice Cream <br
/>
<hr />
<p>Customer Special Request</p>
<hr/>
<textarea name = "customer request" rows ="3" cols= "40">
(ANY SPECIAL REQUEST) </textarea>
</form>
<script type = "text/javascript" src = "lab2.js" >
</script>
</body>
</html>
*******************JS FILE1*******************************************
// Event handler for the form
functiongiveInitsFocus ()
{
// Give focus to the textbox
document.orderForm.name.focus();
}
// text input function
functionisInitialsTextValid()
{
varpos;
var name = document.getElementById("name").value;
varpos = name.search (/^([A-Z]|[a-z]){2,3}$/);
if (pos != 0 )
{
alert ("Error in initials entered is not in correct form. n" +
"Must be first letters of first and last names" );
return false;
} else
return true;
}
// tax function
functionisDiscountValid()
{
var discount = document.getElementById("discount").value;
var position = discount.search (/^d{1,2}$/);
if (position != 0 )
{
alert ("Error in the discount rate entered. n" + " Must be
in x formate one or two digits. No % sign.");
return false;
} else
return true;
}
// SIDE DISH
var FRIES_COST = 9.50;
var CAKE_COST = 12.50;
var ICE_COST = 7.50;
functionhandlefriesclick()
{
if (document.orderForm.SideDish[0].checked == true)
{
alert ("The cost of large basket of fries is $" + FRIES_COST);
}
}
functionhandlecakeclick()
{
if (document.orderForm.SideDish[1].checked == true)
{
alert ("The cost of large tripple fudge cake is $" + CAKE_COST);
}
}
functionhandlecreamclick()
{
if (document.orderForm.SideDish[2].checked == true)
{
alert ("The cost of international ice cream is $" + ICE_COST);
}
}
// MAIN DISH
var BCHICKEN_COST = 6.50;
var FCHICKEN_COST = 5.50;
var BURGER_COST = 4.50;
functionhandlemainDishfchickenclick()
{
alert("The cost of 10 piece fried chicken is $" +FCHICKEN_COST);
}
functionhandlemainDishbchickenclick()
{
alert("The cost of 10 piece baked chicken is $" + BCHICKEN_COST);
}
functionhandlemainDishBurgerclick()
{
alert ("The cost of regular burger is $" + BURGER_COST);
}
functionhandleSubmitClick()
{
var Total = 0;
// statements for sidedish
if (document.orderForm.SideDish[0].checked == true)
{
Total += FRIES_COST;
}
else if (document.orderForm.SideDish[1].checked == true)
{
Total += CAKE_COST;
}
else if (document.orderForm.SideDish[2].checked == true)
{
Total += ICE_COST;
}
// statements for the main dish
if (document.orderForm.mainDish[0].checked == true)
{
Total += FCHICKEN_COST;
}
if(document.orderForm.mainDish[1].checked == true)
{
Total += BCHICKEN_COST;
}
if (document.orderForm.mainDish[2].checked == true)
{
Total += BURGER_COST;
}
// caculate the discount price
var rate;
varcostFinal;
rate = parseFloat (document.getElementById("discount").value / 100 * Total
);
costFinal = ( Total - rate );
alert("The total cost of the meal is $ " + Total + " and the
discount rate is $" + rate.toFixed(2) );
recipt = confirm("The total cost of the meal with discount is
$ "+ costFinal.toFixed(2) + ".n" +
"Do you want to place this order or cancel it");
}
// test the text input
functioncheckInitials()
{
nameCalc = isInitialsTextValid();
if (nameCalc == false)
{
document.orderForm.discount.focus();
document.orderForm.discount.select();
}
else
{
handleSubmitClick();
}
}
// check the discount
function checkDiscount()
{
rateCalc = isDiscountValid();
if (rateCalc == false)
{
document.orderForm.discount.focus();
document.orderForm.discount.select();
}
else
{
handleSubmitClick();
}
}
// check the recipt
if (recipt == false )
{
document.orderForm.Reset.click();
}
****************JS FILE2.********************
// focus
onload = giveInitsFocus;
// submit
document.orderForm.submit.onclick = checkDiscount;
// side dish
document.orderForm.SideDish[0].onclick = handlefriesclick;
document.orderForm.SideDish[1].onclick = handlecakeclick;
document.orderForm.SideDish[2].onclick = handlecreamclick;
// main dish.
document.orderForm.mainDish[0].onclick = handlemainDishfchickenclick;
document.orderForm.mainDish[1].onclick = handlemainDishbchickenclick;
document.orderForm.mainDish[2].onclick = handlemainDishBurgerclick;
SPORTS SYSTEM
SPORTS SYSTEM CODES
***********HTML FILE***********************************************
<?xml version = "1.0" encoding = "utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns = "http://www.w3.org/1999/xhtml">
<head>
<title>SPORTS SYSTEM</title>
</head>
<body>
<h2>Student Athlete </h2>
<script type = "text/javascript" src = "student.js">
</script>
</body>
</html>
*************** Java Scripts file 1*****************
// Event handler for the form
functiongiveInitsFocus ()
{
// Give focus to the textbox
document.orderForm.name.focus();
}
// text input function
functionisInitialsTextValid()
{
varpos;
var name = document.getElementById("name").value;
varpos = name.search (/^([A-Z]|[a-z]){2,3}$/);
if (pos != 0 )
{
alert ("Error in initials entered is not in correct form. n" +
"Must be first letters of first and last names" );
return false;
} else
return true;
}
// tax function
functionisDiscountValid()
{
var discount = document.getElementById("discount").value;
var position = discount.search (/^d{1,2}$/);
if (position != 0 )
{
alert ("Error in the discount rate entered. n" + " Must be
in x formate one or two digits. No % sign.");
return false;
} else
return true;
}
// SIDE DISH
var FRIES_COST = 9.50;
var CAKE_COST = 12.50;
var ICE_COST = 7.50;
functionhandlefriesclick()
{
if (document.orderForm.SideDish[0].checked == true)
{
alert ("The cost of large basket of fries is $" + FRIES_COST);
}
}
functionhandlecakeclick()
{
if (document.orderForm.SideDish[1].checked == true)
{
alert ("The cost of large tripple fudge cake is $" + CAKE_COST);
}
}
functionhandlecreamclick()
{
if (document.orderForm.SideDish[2].checked == true)
{
alert ("The cost of international ice cream is $" + ICE_COST);
}
}
// MAIN DISH
var BCHICKEN_COST = 6.50;
var FCHICKEN_COST = 5.50;
var BURGER_COST = 4.50;
functionhandlemainDishfchickenclick()
{
alert("The cost of 10 piece fried chicken is $" +FCHICKEN_COST);
}
functionhandlemainDishbchickenclick()
{
alert("The cost of 10 piece baked chicken is $" + BCHICKEN_COST);
}
functionhandlemainDishBurgerclick()
{
alert ("The cost of regular burger is $" + BURGER_COST);
}
functionhandleSubmitClick()
{
var Total = 0;
// statements for sidedish
if (document.orderForm.SideDish[0].checked == true)
{
Total += FRIES_COST;
}
else if (document.orderForm.SideDish[1].checked == true)
{
Total += CAKE_COST;
}
else if (document.orderForm.SideDish[2].checked == true)
{
Total += ICE_COST;
}
// statements for the main dish
if (document.orderForm.mainDish[0].checked == true)
{
Total += FCHICKEN_COST;
}
if(document.orderForm.mainDish[1].checked == true)
{
Total += BCHICKEN_COST;
}
if (document.orderForm.mainDish[2].checked == true)
{
Total += BURGER_COST;
}
// caculate the discount price
var rate;
varcostFinal;
rate = parseFloat (document.getElementById("discount").value / 100 * Total
);
costFinal = ( Total - rate );
alert("The total cost of the meal is $ " + Total + " and the
discount rate is $" + rate.toFixed(2) );
recipt = confirm("The total cost of the meal with discount is
$ "+ costFinal.toFixed(2) + ".n" +
"Do you want to place this order or cancel it");
}
// test the text input
functioncheckInitials()
{
nameCalc = isInitialsTextValid();
if (nameCalc == false)
{
document.orderForm.discount.focus();
document.orderForm.discount.select();
}
else
{
handleSubmitClick();
}
}
// check the discount
function checkDiscount()
{
rateCalc = isDiscountValid();
if (rateCalc == false)
{
document.orderForm.discount.focus();
document.orderForm.discount.select();
}
else
{
handleSubmitClick();
}
}
// check the recipt
if (recipt == false )
{
document.orderForm.Reset.click();
}
*******************Java Scripts File2*******************
// focus
onload = giveInitsFocus;
// submit
document.orderForm.submit.onclick = checkDiscount;
// side dish
document.orderForm.SideDish[0].onclick = handlefriesclick;
document.orderForm.SideDish[1].onclick = handlecakeclick;
document.orderForm.SideDish[2].onclick = handlecreamclick;
// main dish.
document.orderForm.mainDish[0].onclick = handlemainDishfchickenclick;
document.orderForm.mainDish[1].onclick = handlemainDishbchickenclick;
document.orderForm.mainDish[2].onclick = handlemainDishBurgerclick;

Más contenido relacionado

La actualidad más candente

React.js or why DOM finally makes sense
React.js or why DOM finally makes senseReact.js or why DOM finally makes sense
React.js or why DOM finally makes sense
Eldar Djafarov
 
AngularJS Data Binding
AngularJS Data BindingAngularJS Data Binding
AngularJS Data Binding
Ticore Shih
 

La actualidad más candente (20)

Java script Advance
Java script   AdvanceJava script   Advance
Java script Advance
 
JAVA SCRIPT
JAVA SCRIPTJAVA SCRIPT
JAVA SCRIPT
 
Portafolio.carlos serrano grupo 201512_20
Portafolio.carlos serrano grupo 201512_20Portafolio.carlos serrano grupo 201512_20
Portafolio.carlos serrano grupo 201512_20
 
The Principle of Hybrid App.
The Principle of Hybrid App.The Principle of Hybrid App.
The Principle of Hybrid App.
 
Java script
Java scriptJava script
Java script
 
Orbitz and Spring Webflow Case Study
Orbitz and Spring Webflow Case StudyOrbitz and Spring Webflow Case Study
Orbitz and Spring Webflow Case Study
 
Ridingapachecamel
RidingapachecamelRidingapachecamel
Ridingapachecamel
 
React.js or why DOM finally makes sense
React.js or why DOM finally makes senseReact.js or why DOM finally makes sense
React.js or why DOM finally makes sense
 
Лабораторная работа №1
Лабораторная работа №1Лабораторная работа №1
Лабораторная работа №1
 
AngularJS Data Binding
AngularJS Data BindingAngularJS Data Binding
AngularJS Data Binding
 
Soap ui automation
Soap ui automationSoap ui automation
Soap ui automation
 
22 j query1
22 j query122 j query1
22 j query1
 
Managing states
Managing statesManaging states
Managing states
 
Relaxing With CouchDB
Relaxing With CouchDBRelaxing With CouchDB
Relaxing With CouchDB
 
jQuery
jQueryjQuery
jQuery
 
Introduction to java_script
Introduction to java_scriptIntroduction to java_script
Introduction to java_script
 
Javascript
JavascriptJavascript
Javascript
 
Getting started with MongoDB and Scala - Open Source Bridge 2012
Getting started with MongoDB and Scala - Open Source Bridge 2012Getting started with MongoDB and Scala - Open Source Bridge 2012
Getting started with MongoDB and Scala - Open Source Bridge 2012
 
AngularJS Compile Process
AngularJS Compile ProcessAngularJS Compile Process
AngularJS Compile Process
 
Introduction to AngularJS (@oakjug June 2013)
Introduction to AngularJS (@oakjug June 2013)Introduction to AngularJS (@oakjug June 2013)
Introduction to AngularJS (@oakjug June 2013)
 

Destacado

信息技术作业
信息技术作业信息技术作业
信息技术作业
wangqian1990
 
Room key
Room keyRoom key
Room key
cmhagc
 
Miscellaneous-Animesh chandra
Miscellaneous-Animesh chandraMiscellaneous-Animesh chandra
Miscellaneous-Animesh chandra
Animesh Chandra
 

Destacado (20)

Jaringan Epitel
Jaringan EpitelJaringan Epitel
Jaringan Epitel
 
Semantic-Driven CEP for Delivery of Information Streams in Data-Intensive Mon...
Semantic-Driven CEP for Delivery of Information Streams in Data-Intensive Mon...Semantic-Driven CEP for Delivery of Information Streams in Data-Intensive Mon...
Semantic-Driven CEP for Delivery of Information Streams in Data-Intensive Mon...
 
Tutorial de monitores lcd
Tutorial de monitores lcdTutorial de monitores lcd
Tutorial de monitores lcd
 
Cognicity Challenge - LeWeb 2014
Cognicity Challenge - LeWeb 2014Cognicity Challenge - LeWeb 2014
Cognicity Challenge - LeWeb 2014
 
Conflict Resolution
Conflict ResolutionConflict Resolution
Conflict Resolution
 
信息技术作业
信息技术作业信息技术作业
信息技术作业
 
Газовый напольный котел Protherm Медведь 30 PLO
Газовый напольный котел Protherm Медведь 30 PLOГазовый напольный котел Protherm Медведь 30 PLO
Газовый напольный котел Protherm Медведь 30 PLO
 
Rr100 b
Rr100 bRr100 b
Rr100 b
 
Children’s overextension of basic level vocabulary
Children’s overextension of basic level vocabularyChildren’s overextension of basic level vocabulary
Children’s overextension of basic level vocabulary
 
Food and fashion
Food and fashion Food and fashion
Food and fashion
 
Redação científica i afonso
Redação científica i   afonsoRedação científica i   afonso
Redação científica i afonso
 
Room key
Room keyRoom key
Room key
 
Morris Villarroel: A Four-Year Journal
Morris Villarroel: A Four-Year JournalMorris Villarroel: A Four-Year Journal
Morris Villarroel: A Four-Year Journal
 
Decision Support Tool for Retrofitting a District Towards District as a Service
Decision Support Tool for Retrofitting a District Towards District as a ServiceDecision Support Tool for Retrofitting a District Towards District as a Service
Decision Support Tool for Retrofitting a District Towards District as a Service
 
[Japanese]2011 dec ttc+arib
[Japanese]2011 dec ttc+arib[Japanese]2011 dec ttc+arib
[Japanese]2011 dec ttc+arib
 
Miscellaneous-Animesh chandra
Miscellaneous-Animesh chandraMiscellaneous-Animesh chandra
Miscellaneous-Animesh chandra
 
My ideal home
My ideal homeMy ideal home
My ideal home
 
Cook
CookCook
Cook
 
The dr overnight dba
The dr overnight dbaThe dr overnight dba
The dr overnight dba
 
Монтаж модульных ограждений
Монтаж модульных огражденийМонтаж модульных ограждений
Монтаж модульных ограждений
 

Similar a Web Scripting Project JavaScripts and HTML WebPage

网站无障碍阅读知识
网站无障碍阅读知识网站无障碍阅读知识
网站无障碍阅读知识
ppanyong
 
网站无障碍阅读知识
网站无障碍阅读知识网站无障碍阅读知识
网站无障碍阅读知识
ppanyong
 
Private slideshow
Private slideshowPrivate slideshow
Private slideshow
sblackman
 
Doctype html public
Doctype html publicDoctype html public
Doctype html public
ecuapool
 
Los Estados De La Materia
Los Estados De La MateriaLos Estados De La Materia
Los Estados De La Materia
Mayritalinda
 
El Tiempo Nos Ensea 214392
El Tiempo Nos Ensea 214392El Tiempo Nos Ensea 214392
El Tiempo Nos Ensea 214392
guestc65f09
 

Similar a Web Scripting Project JavaScripts and HTML WebPage (20)

Intro to JavaScript
Intro to JavaScriptIntro to JavaScript
Intro to JavaScript
 
网站无障碍阅读知识
网站无障碍阅读知识网站无障碍阅读知识
网站无障碍阅读知识
 
网站无障碍阅读知识
网站无障碍阅读知识网站无障碍阅读知识
网站无障碍阅读知识
 
Soa lab 3
Soa lab 3Soa lab 3
Soa lab 3
 
Private slideshow
Private slideshowPrivate slideshow
Private slideshow
 
Doctype html public
Doctype html publicDoctype html public
Doctype html public
 
Practica n° 7
Practica n° 7Practica n° 7
Practica n° 7
 
Los Estados De La Materia
Los Estados De La MateriaLos Estados De La Materia
Los Estados De La Materia
 
Intro to JavaScript
Intro to JavaScriptIntro to JavaScript
Intro to JavaScript
 
Broadleaf Presents Thymeleaf
Broadleaf Presents ThymeleafBroadleaf Presents Thymeleaf
Broadleaf Presents Thymeleaf
 
El Tiempo Nos Ensea 214392
El Tiempo Nos Ensea 214392El Tiempo Nos Ensea 214392
El Tiempo Nos Ensea 214392
 
Quick reference for spark sql
Quick reference for spark sqlQuick reference for spark sql
Quick reference for spark sql
 
Rich Portlet Development in uPortal
Rich Portlet Development in uPortalRich Portlet Development in uPortal
Rich Portlet Development in uPortal
 
Java script
Java scriptJava script
Java script
 
Polymer 1.0
Polymer 1.0Polymer 1.0
Polymer 1.0
 
DHTML - Dynamic HTML
DHTML - Dynamic HTMLDHTML - Dynamic HTML
DHTML - Dynamic HTML
 
Internationalization(i18n) of Web Page
Internationalization(i18n) of Web PageInternationalization(i18n) of Web Page
Internationalization(i18n) of Web Page
 
HTML_HHC
HTML_HHCHTML_HHC
HTML_HHC
 
Vaadin Components @ Angular U
Vaadin Components @ Angular UVaadin Components @ Angular U
Vaadin Components @ Angular U
 
Backbone.js — Introduction to client-side JavaScript MVC
Backbone.js — Introduction to client-side JavaScript MVCBackbone.js — Introduction to client-side JavaScript MVC
Backbone.js — Introduction to client-side JavaScript MVC
 

Más de Sunny U Okoro

BI Apps Reports 5 QlikSense Desktop
BI Apps Reports 5  QlikSense DesktopBI Apps Reports 5  QlikSense Desktop
BI Apps Reports 5 QlikSense Desktop
Sunny U Okoro
 
MS SSAS 2008 & MDX Reports
MS SSAS 2008 &  MDX Reports MS SSAS 2008 &  MDX Reports
MS SSAS 2008 & MDX Reports
Sunny U Okoro
 
DBA Oracle,SQL Server, MYSQL,DB2 Express Postgres & Sybase
DBA Oracle,SQL Server, MYSQL,DB2 Express Postgres & SybaseDBA Oracle,SQL Server, MYSQL,DB2 Express Postgres & Sybase
DBA Oracle,SQL Server, MYSQL,DB2 Express Postgres & Sybase
Sunny U Okoro
 
BI Apps ETL 4- Informatica PowerCenter Express
BI  Apps ETL 4- Informatica PowerCenter  ExpressBI  Apps ETL 4- Informatica PowerCenter  Express
BI Apps ETL 4- Informatica PowerCenter Express
Sunny U Okoro
 
BI Apps Reports 4 Cognos BI and Crystal Reports
BI Apps Reports 4  Cognos BI and Crystal ReportsBI Apps Reports 4  Cognos BI and Crystal Reports
BI Apps Reports 4 Cognos BI and Crystal Reports
Sunny U Okoro
 
Tableau Reports and Oracle OBIEE
Tableau Reports and  Oracle OBIEETableau Reports and  Oracle OBIEE
Tableau Reports and Oracle OBIEE
Sunny U Okoro
 
DB 3 Sybase ASE 15 & MS SQL Server
DB 3 Sybase ASE 15 & MS SQL Server DB 3 Sybase ASE 15 & MS SQL Server
DB 3 Sybase ASE 15 & MS SQL Server
Sunny U Okoro
 
Advanced ETL2 Pentaho
Advanced ETL2  Pentaho Advanced ETL2  Pentaho
Advanced ETL2 Pentaho
Sunny U Okoro
 
BI Apps Reports2- Oracle OBIEE & SAP Business Objects
BI Apps Reports2- Oracle OBIEE & SAP Business ObjectsBI Apps Reports2- Oracle OBIEE & SAP Business Objects
BI Apps Reports2- Oracle OBIEE & SAP Business Objects
Sunny U Okoro
 
MiS SharePoint 2010-SSRS, Power View & PowerPivot 2012
MiS SharePoint 2010-SSRS, Power View & PowerPivot 2012MiS SharePoint 2010-SSRS, Power View & PowerPivot 2012
MiS SharePoint 2010-SSRS, Power View & PowerPivot 2012
Sunny U Okoro
 
BI Apps OLAP & Reports- SSAS 2012 Tabular & Multidimensional
BI Apps  OLAP & Reports- SSAS 2012 Tabular & Multidimensional BI Apps  OLAP & Reports- SSAS 2012 Tabular & Multidimensional
BI Apps OLAP & Reports- SSAS 2012 Tabular & Multidimensional
Sunny U Okoro
 
Advanced SSRS 2012-SSAS,SSIS, XML, ASP.NET,Forms
Advanced SSRS 2012-SSAS,SSIS, XML, ASP.NET,FormsAdvanced SSRS 2012-SSAS,SSIS, XML, ASP.NET,Forms
Advanced SSRS 2012-SSAS,SSIS, XML, ASP.NET,Forms
Sunny U Okoro
 
Advanced ETL MS SSIS 2012 & Talend
Advanced ETL  MS  SSIS 2012 & Talend Advanced ETL  MS  SSIS 2012 & Talend
Advanced ETL MS SSIS 2012 & Talend
Sunny U Okoro
 
DB Develop 2 Oracle 12c, DB2, MYSQL, SQL Anywhere 16
 DB Develop 2 Oracle 12c, DB2, MYSQL, SQL Anywhere 16  DB Develop 2 Oracle 12c, DB2, MYSQL, SQL Anywhere 16
DB Develop 2 Oracle 12c, DB2, MYSQL, SQL Anywhere 16
Sunny U Okoro
 
DB Security Oracle 11g-Application Context, Dynamic Views & Aduits
DB Security Oracle 11g-Application Context, Dynamic Views & AduitsDB Security Oracle 11g-Application Context, Dynamic Views & Aduits
DB Security Oracle 11g-Application Context, Dynamic Views & Aduits
Sunny U Okoro
 

Más de Sunny U Okoro (20)

SQL Server and SSAS
SQL Server and SSAS SQL Server and SSAS
SQL Server and SSAS
 
BI Apps Reports 5 QlikSense Desktop
BI Apps Reports 5  QlikSense DesktopBI Apps Reports 5  QlikSense Desktop
BI Apps Reports 5 QlikSense Desktop
 
MS SSAS 2008 & MDX Reports
MS SSAS 2008 &  MDX Reports MS SSAS 2008 &  MDX Reports
MS SSAS 2008 & MDX Reports
 
DBA Oracle,SQL Server, MYSQL,DB2 Express Postgres & Sybase
DBA Oracle,SQL Server, MYSQL,DB2 Express Postgres & SybaseDBA Oracle,SQL Server, MYSQL,DB2 Express Postgres & Sybase
DBA Oracle,SQL Server, MYSQL,DB2 Express Postgres & Sybase
 
Database Migration
Database MigrationDatabase Migration
Database Migration
 
Cognos Express
Cognos ExpressCognos Express
Cognos Express
 
BI Apps ETL 4- Informatica PowerCenter Express
BI  Apps ETL 4- Informatica PowerCenter  ExpressBI  Apps ETL 4- Informatica PowerCenter  Express
BI Apps ETL 4- Informatica PowerCenter Express
 
Oracle ODI
Oracle ODIOracle ODI
Oracle ODI
 
BI Apps Reports 4 Cognos BI and Crystal Reports
BI Apps Reports 4  Cognos BI and Crystal ReportsBI Apps Reports 4  Cognos BI and Crystal Reports
BI Apps Reports 4 Cognos BI and Crystal Reports
 
Tableau Reports and Oracle OBIEE
Tableau Reports and  Oracle OBIEETableau Reports and  Oracle OBIEE
Tableau Reports and Oracle OBIEE
 
DB 3 Sybase ASE 15 & MS SQL Server
DB 3 Sybase ASE 15 & MS SQL Server DB 3 Sybase ASE 15 & MS SQL Server
DB 3 Sybase ASE 15 & MS SQL Server
 
MS SSAS 2012 & MDX
MS SSAS 2012  &  MDXMS SSAS 2012  &  MDX
MS SSAS 2012 & MDX
 
Advanced ETL2 Pentaho
Advanced ETL2  Pentaho Advanced ETL2  Pentaho
Advanced ETL2 Pentaho
 
BI Apps Reports2- Oracle OBIEE & SAP Business Objects
BI Apps Reports2- Oracle OBIEE & SAP Business ObjectsBI Apps Reports2- Oracle OBIEE & SAP Business Objects
BI Apps Reports2- Oracle OBIEE & SAP Business Objects
 
MiS SharePoint 2010-SSRS, Power View & PowerPivot 2012
MiS SharePoint 2010-SSRS, Power View & PowerPivot 2012MiS SharePoint 2010-SSRS, Power View & PowerPivot 2012
MiS SharePoint 2010-SSRS, Power View & PowerPivot 2012
 
BI Apps OLAP & Reports- SSAS 2012 Tabular & Multidimensional
BI Apps  OLAP & Reports- SSAS 2012 Tabular & Multidimensional BI Apps  OLAP & Reports- SSAS 2012 Tabular & Multidimensional
BI Apps OLAP & Reports- SSAS 2012 Tabular & Multidimensional
 
Advanced SSRS 2012-SSAS,SSIS, XML, ASP.NET,Forms
Advanced SSRS 2012-SSAS,SSIS, XML, ASP.NET,FormsAdvanced SSRS 2012-SSAS,SSIS, XML, ASP.NET,Forms
Advanced SSRS 2012-SSAS,SSIS, XML, ASP.NET,Forms
 
Advanced ETL MS SSIS 2012 & Talend
Advanced ETL  MS  SSIS 2012 & Talend Advanced ETL  MS  SSIS 2012 & Talend
Advanced ETL MS SSIS 2012 & Talend
 
DB Develop 2 Oracle 12c, DB2, MYSQL, SQL Anywhere 16
 DB Develop 2 Oracle 12c, DB2, MYSQL, SQL Anywhere 16  DB Develop 2 Oracle 12c, DB2, MYSQL, SQL Anywhere 16
DB Develop 2 Oracle 12c, DB2, MYSQL, SQL Anywhere 16
 
DB Security Oracle 11g-Application Context, Dynamic Views & Aduits
DB Security Oracle 11g-Application Context, Dynamic Views & AduitsDB Security Oracle 11g-Application Context, Dynamic Views & Aduits
DB Security Oracle 11g-Application Context, Dynamic Views & Aduits
 

Último

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Último (20)

Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 

Web Scripting Project JavaScripts and HTML WebPage

  • 1. Web Scripts Project JavaScript and HTML Webpage Demo By Sunny Okoro
  • 2. Table of Contents INTRODUCTION.............................................................................................................................................2 ORDER SYSTEM .............................................................................................................................................3 ORDER SYSTEM CODES .................................................................................................................................8 PAYROLL CALCULATIONS ............................................................................................................................10 PAYROLL CALCULATION CODES ..................................................................................................................13 RESTAURANT SYSTEM.................................................................................................................................15 RESTAURANT SYSTEM CODES.....................................................................................................................18 SPORTS SYSTEM ..........................................................................................................................................25 SPORTS SYSTEM CODES ..............................................................................................................................32
  • 3. INTRODUCTION This document contains different web scripting small programs created in Java Scripts and HTML.
  • 6.
  • 7.
  • 8.
  • 9. ORDER SYSTEM CODES Java Scripts & HTML Codes ****************metric.js file*************************************** // convert pounds into kilograms// var Pounds = parseFloat(prompt ("Enter the number of pounds to be converted into killograms. n", " ")); varkillograms = Pounds * 0.4536; //I added the lb symbol for pounds display enterd by the user. document.writeln("Pounds enterned is: " + Pounds + "lb" ); //I added the kg symbol for killograms result. document.writeln("<p>killograms is: " + killograms + "Kg" ); *********order.js file*************************************************** // Get the input from the user// var price = parseFloat(prompt ("What is the price of your order? No dollar sign. n", " ")); var tax =parseFloat(prompt ("What is the percenntage of the sales tax of your order? No percentage sign. n", " ")); //calculate the total price and total prince for the order enter varFinaltax = tax /100; varSalestax = price * Finaltax; varFinalprice = price + Salestax ; // Display the results back to the customer document.write("<p> Order price entered: $ "); document.writeln(price); document.write("<p> Percentage of sales tax entered: "); document.write( + tax + "%" ); document.write("<p> Calculated sales tax to : $"); document.write(Salestax); document.write("<p> Total price calculated with tax: $"); document.write(Finalprice); ******************order.html**********************************
  • 10. <?xml version = "1.0" encoding = "utf-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns = "http://www.w3.org/1999/xhtml"> <head> <title> order java systems</title> </head> <body> <script type = "text/javascript" src="order.js"> </script> </body> </html> ******************************systemorder.html************ <?xml version = "1.0" encoding = "utf-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns = "http://www.w3.org/1999/xhtml"> <head> <title> order java systems</title> </head> <body> <h1> Calculate book price</h1> <script type = "text/javascript" src = "order.js"> </script><br/> <h1> Metric Calculator </h1> <script type = "text/javascript" src = "Metric.js"> </script><br/> </body> </html> ************************************************************************** **
  • 12.
  • 13.
  • 14. PAYROLL CALCULATION CODES *****payrollcalculation.js file************************************** varnetPay = 0; var gross = 0; vartotalNet = 0; vartotalGross = 0; varnumEmp; varhourlyRate = 0; var rate; var deduction = 0; var MAX_HOURS = 80; var FULL_HOURS = 40; // get number of eployees from the user numEmp = parseInt(prompt("Enter the number of employes? n", " ")); // calculate the hours worked. for (varemp = 1; emp<= numEmp; emp++) {
  • 15. var hours = 0; // Get the hours worked from the user. hours = parseFloat(prompt ("Enter number of hours worked by employee #" + emp + "n", " ")); while(hours < 0 || hours > MAX_HOURS){ hours = parseFloat(prompt ("Enter your hours worked.n hours must be between 0 and " + MAX_HOURS + " hours", " ")); } if (hours < FULL_HOURS) rate = .15; else rate = .30; // Get the hourly rate from the user. varhourlyRate = 0; hourlyRate = parseFloat(prompt ("Enter employee #" + emp + " hourly raten", " ")); // Validate the input by the user. while (hourlyRate< 7.50 || hourlyRate> 15.00 ) { hourlyRate = parseFloat(prompt ("Enter your hourly raten Must be between 7.50 & 15.00", " ")); } gross = hours * hourlyRate; deduction = rate * gross; netPay = gross - deduction; totalNet += netPay; totalGross += gross; // print the results document.write("<p>Employee #" + emp + " worked " + hours + " hours at $" + hourlyRate + " per hour for gross pay of $" + gross + " and net pay of $" + netPay + " based on a tax rate of " + rate * 100 + "%." ); } document.write("<p> Total grosspay is $" + totalGross); document.write("<p> Total netpay is $" + totalNet ); ************************payrollcalculation.html*************************** <?xml version = "1.0" encoding = "utf-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns = "http://www.w3.org/1999/xhtml"> <head> <title>Payroll Caclculator</title>
  • 16. </head> <body> <h2>Payroll Calculations</h2> <script type = "text/javascript" src = "payrollcalculations.js"> </script> </body> </html> RESTAURANT SYSTEM
  • 17.
  • 18.
  • 19. RESTAURANT SYSTEM CODES Java Scripts & Html Codes <?xml version = "1.0" encoding = "utf-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns = "http://www.w3.org/1999/xhtml"> <!-- IST 350 LAB 16 --> <head> <title> ROSEHILL STAR RESTAURANT </title> <script type = "text/javascript" src = "lab.js" > </script>
  • 20. </head> <body> <p><h1>ROSEHILL STAR RESTAURANT ORDER SYSTEM</h1></p> <form name = "orderForm" action = " "> <p> <input type= "button" id = "submit" name = "submit" value = "Submit Order" /> <input type = "reset" id = "Reset" value = "Clear Order"/> </p> <p> Please enter your initials </p> <input type =" text" id = "name" name ="name" size="3" maxlength="3" /> <p> Please enter the discount rate without % sign </p> <input type =" text" id = "discount" name ="discount" size="5" maxlength="5" /> <p><h2>MENU</h2></p>
  • 21. <p><h4>Main dish </h4></p> <input type= "radio" name = "mainDish" id ="fchicken" value=" FriedChicken" checked ="checked" /> Fried Chicken <br /> <input type = "radio" name ="mainDish" id = "chicken" value="BakedChicken" /> Baked Chicken<br /> <input type = "radio" name ="mainDish" id ="Burger" value= "Burger" onclick="handlemainDishBurgerclick();" /> Burger <br /> <p><h4>Side dish</h4></p> <input type= "checkbox" name = "SideDish" id ="fries" value=" fries" checked ="checked" /> French fries <br /> <input type = "checkbox" name ="SideDish" id ="cake" value="cake" /> Triple fudge cake <br /> <input type = "checkbox" name ="SideDish" id = "cream" value= "cream" /> International Ice Cream <br />
  • 22. <hr /> <p>Customer Special Request</p> <hr/> <textarea name = "customer request" rows ="3" cols= "40"> (ANY SPECIAL REQUEST) </textarea> </form> <script type = "text/javascript" src = "lab2.js" > </script> </body> </html> *******************JS FILE1******************************************* // Event handler for the form functiongiveInitsFocus () { // Give focus to the textbox document.orderForm.name.focus(); } // text input function functionisInitialsTextValid() { varpos; var name = document.getElementById("name").value; varpos = name.search (/^([A-Z]|[a-z]){2,3}$/);
  • 23. if (pos != 0 ) { alert ("Error in initials entered is not in correct form. n" + "Must be first letters of first and last names" ); return false; } else return true; } // tax function functionisDiscountValid() { var discount = document.getElementById("discount").value; var position = discount.search (/^d{1,2}$/); if (position != 0 ) { alert ("Error in the discount rate entered. n" + " Must be in x formate one or two digits. No % sign."); return false; } else return true; } // SIDE DISH var FRIES_COST = 9.50; var CAKE_COST = 12.50; var ICE_COST = 7.50; functionhandlefriesclick() { if (document.orderForm.SideDish[0].checked == true) { alert ("The cost of large basket of fries is $" + FRIES_COST); } } functionhandlecakeclick() { if (document.orderForm.SideDish[1].checked == true) { alert ("The cost of large tripple fudge cake is $" + CAKE_COST); } } functionhandlecreamclick() { if (document.orderForm.SideDish[2].checked == true) { alert ("The cost of international ice cream is $" + ICE_COST); } } // MAIN DISH
  • 24. var BCHICKEN_COST = 6.50; var FCHICKEN_COST = 5.50; var BURGER_COST = 4.50; functionhandlemainDishfchickenclick() { alert("The cost of 10 piece fried chicken is $" +FCHICKEN_COST); } functionhandlemainDishbchickenclick() { alert("The cost of 10 piece baked chicken is $" + BCHICKEN_COST); } functionhandlemainDishBurgerclick() { alert ("The cost of regular burger is $" + BURGER_COST); } functionhandleSubmitClick() { var Total = 0; // statements for sidedish if (document.orderForm.SideDish[0].checked == true) { Total += FRIES_COST; } else if (document.orderForm.SideDish[1].checked == true) { Total += CAKE_COST; } else if (document.orderForm.SideDish[2].checked == true) { Total += ICE_COST; } // statements for the main dish if (document.orderForm.mainDish[0].checked == true) { Total += FCHICKEN_COST; } if(document.orderForm.mainDish[1].checked == true) { Total += BCHICKEN_COST; } if (document.orderForm.mainDish[2].checked == true) { Total += BURGER_COST; }
  • 25. // caculate the discount price var rate; varcostFinal; rate = parseFloat (document.getElementById("discount").value / 100 * Total ); costFinal = ( Total - rate ); alert("The total cost of the meal is $ " + Total + " and the discount rate is $" + rate.toFixed(2) ); recipt = confirm("The total cost of the meal with discount is $ "+ costFinal.toFixed(2) + ".n" + "Do you want to place this order or cancel it"); } // test the text input functioncheckInitials() { nameCalc = isInitialsTextValid(); if (nameCalc == false) { document.orderForm.discount.focus(); document.orderForm.discount.select(); } else { handleSubmitClick(); } } // check the discount function checkDiscount() { rateCalc = isDiscountValid(); if (rateCalc == false) { document.orderForm.discount.focus(); document.orderForm.discount.select(); } else { handleSubmitClick();
  • 26. } } // check the recipt if (recipt == false ) { document.orderForm.Reset.click(); } ****************JS FILE2.******************** // focus onload = giveInitsFocus; // submit document.orderForm.submit.onclick = checkDiscount; // side dish document.orderForm.SideDish[0].onclick = handlefriesclick; document.orderForm.SideDish[1].onclick = handlecakeclick; document.orderForm.SideDish[2].onclick = handlecreamclick; // main dish. document.orderForm.mainDish[0].onclick = handlemainDishfchickenclick; document.orderForm.mainDish[1].onclick = handlemainDishbchickenclick; document.orderForm.mainDish[2].onclick = handlemainDishBurgerclick; SPORTS SYSTEM
  • 27.
  • 28.
  • 29.
  • 30.
  • 31.
  • 32.
  • 33. SPORTS SYSTEM CODES ***********HTML FILE*********************************************** <?xml version = "1.0" encoding = "utf-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns = "http://www.w3.org/1999/xhtml"> <head> <title>SPORTS SYSTEM</title> </head> <body> <h2>Student Athlete </h2> <script type = "text/javascript" src = "student.js"> </script> </body> </html> *************** Java Scripts file 1***************** // Event handler for the form functiongiveInitsFocus () { // Give focus to the textbox document.orderForm.name.focus(); } // text input function functionisInitialsTextValid() { varpos; var name = document.getElementById("name").value;
  • 34. varpos = name.search (/^([A-Z]|[a-z]){2,3}$/); if (pos != 0 ) { alert ("Error in initials entered is not in correct form. n" + "Must be first letters of first and last names" ); return false; } else return true; } // tax function functionisDiscountValid() { var discount = document.getElementById("discount").value; var position = discount.search (/^d{1,2}$/); if (position != 0 ) { alert ("Error in the discount rate entered. n" + " Must be in x formate one or two digits. No % sign."); return false; } else return true; } // SIDE DISH var FRIES_COST = 9.50; var CAKE_COST = 12.50; var ICE_COST = 7.50; functionhandlefriesclick() { if (document.orderForm.SideDish[0].checked == true) { alert ("The cost of large basket of fries is $" + FRIES_COST); } } functionhandlecakeclick() { if (document.orderForm.SideDish[1].checked == true) { alert ("The cost of large tripple fudge cake is $" + CAKE_COST); } } functionhandlecreamclick() { if (document.orderForm.SideDish[2].checked == true) { alert ("The cost of international ice cream is $" + ICE_COST); }
  • 35. } // MAIN DISH var BCHICKEN_COST = 6.50; var FCHICKEN_COST = 5.50; var BURGER_COST = 4.50; functionhandlemainDishfchickenclick() { alert("The cost of 10 piece fried chicken is $" +FCHICKEN_COST); } functionhandlemainDishbchickenclick() { alert("The cost of 10 piece baked chicken is $" + BCHICKEN_COST); } functionhandlemainDishBurgerclick() { alert ("The cost of regular burger is $" + BURGER_COST); } functionhandleSubmitClick() { var Total = 0; // statements for sidedish if (document.orderForm.SideDish[0].checked == true) { Total += FRIES_COST; } else if (document.orderForm.SideDish[1].checked == true) { Total += CAKE_COST; } else if (document.orderForm.SideDish[2].checked == true) { Total += ICE_COST; } // statements for the main dish if (document.orderForm.mainDish[0].checked == true) { Total += FCHICKEN_COST; } if(document.orderForm.mainDish[1].checked == true) { Total += BCHICKEN_COST; } if (document.orderForm.mainDish[2].checked == true) { Total += BURGER_COST; }
  • 36. // caculate the discount price var rate; varcostFinal; rate = parseFloat (document.getElementById("discount").value / 100 * Total ); costFinal = ( Total - rate ); alert("The total cost of the meal is $ " + Total + " and the discount rate is $" + rate.toFixed(2) ); recipt = confirm("The total cost of the meal with discount is $ "+ costFinal.toFixed(2) + ".n" + "Do you want to place this order or cancel it"); } // test the text input functioncheckInitials() { nameCalc = isInitialsTextValid(); if (nameCalc == false) { document.orderForm.discount.focus(); document.orderForm.discount.select(); } else { handleSubmitClick(); } } // check the discount function checkDiscount() { rateCalc = isDiscountValid(); if (rateCalc == false) { document.orderForm.discount.focus(); document.orderForm.discount.select(); } else
  • 37. { handleSubmitClick(); } } // check the recipt if (recipt == false ) { document.orderForm.Reset.click(); } *******************Java Scripts File2******************* // focus onload = giveInitsFocus; // submit document.orderForm.submit.onclick = checkDiscount; // side dish document.orderForm.SideDish[0].onclick = handlefriesclick; document.orderForm.SideDish[1].onclick = handlecakeclick; document.orderForm.SideDish[2].onclick = handlecreamclick; // main dish. document.orderForm.mainDish[0].onclick = handlemainDishfchickenclick; document.orderForm.mainDish[1].onclick = handlemainDishbchickenclick; document.orderForm.mainDish[2].onclick = handlemainDishBurgerclick;