WEB PROGRAMMING HTML write a webpage to order widgets. There are 3 kinds of widg
ID: 3758124 • Letter: W
Question
WEB PROGRAMMING
HTML
write a webpage to order widgets. There are 3 kinds of widgets: model 37AX-L whose price is $12.45 each, model 42XR-J whose price is $15.34 each, and model 93ZZ-A whose price is $28.99 each. (If you like, you can create descriptions of each.) The page will contain a form allowing the user to enter the number of each type, defaulting to 0, and a field for the state. When the user clicks “submit”, the page must check that each quantity is not negative and if any is negative, indicate which is negative. If the total number of items is larger than 25, produce a message that additional shipping will be required and ask for confirmation. If either any quantity is negative or the the client does not accept the extra shipping, do not send the data to the server. When the user clicks “submit” and the tests are successful, the page sents the data to the server. The server then computes the total price. If the user ordered more than 40 widgets total, there will be a 5% discount on the total. If the state is ‘IL’, a 4.375% sales tax is computed. The shipping fee is $9.75 for less than or equal to 25 total items and it is $17.30 if there are more than 25 items [no sales tax on shipping]. The server then send a page giving the model, quantity, and total for each widget; the sum of costs for all 3 models; the discount if any; the sales tax if any; the shipping charge; and the final amount due.
Explanation / Answer
(function() {
if (window.jQuery === undefined || window.jQuery.fn.jquery !== '1.4.2') {
var script_tag = document.createElement('script');
script_tag.setAttribute("type","text/javascript");
script_tag.setAttribute("src",
"http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js");
if (script_tag.readyState) {
script_tag.onreadystatechange = function () { // For old versions of IE
if (this.readyState == 'complete' || this.readyState == 'loaded') {
scriptLoadHandler();
}
};
} else { // Other browsers
script_tag.onload = scriptLoadHandler;
}
// Try to find the head, otherwise default to the documentElement
(document.getElementsByTagName("head")[0] || document.documentElement).appendChild(script_tag);
} else {
// The jQuery version on the window is the one we want to use
jQuery = window.jQuery;
main();
function scriptLoadHandler() {
// Restore $ and window.jQuery to their previous values and store the
// new jQuery in our local jQuery variable
jQuery = window.jQuery.noConflict(true);
// Call our main function
main();
}
function main() {
jQuery(document).ready(function($) {
// We can use jQuery 1.4.2 here
});
}
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.