form.js
function check() {
var message;
var name = document.forms["myForm"]["Name"].value;
var age = document.forms["myForm"]["Age"].value;
var address = document.forms["myForm"]["Address"].value;
var phone = document.forms["myForm"]["Telephone"].value;
var email = document.forms["myForm"]["Email"].value;
var dvdRom = document.forms["myForm"]["DVD_ROM"].checked;
var cardReader = document.forms["myForm"]["Card_Reader"].checked;
var externalHDD = document.forms["myForm"]["ehd"].checked;
var core6 = document.forms["myForm"]["6-core"].checked;
var core8 = document.forms["myForm"]["8-core"].checked;
var a1, a2, a3, a4, a5;
if (dvdRom) {
a1 = "DVD_ROM\n";
}
else {
a1 = "";
}
if (cardReader) {
a2 = "Card Reader\n";
}
else {
a2 = "";
}
if (externalHDD) {
a3 = "External Hard Drive\n";
}
else {
a3 = "";
}
if (core6) {
a4 = "2.6GHz 6-core";
}
else {
a4 = "";
}
if (core8) {
a5 = "2.4GHz 8-core 4.4 GHz";
}
else {
a5 = "";
}
if (name == "" || age == "" || address == "" || phone == "" || email == "" || (!dvdRom && !cardReader && externalHDD) || (!core6 && !core8)) {
alert("Please complete all of the form");
}
else {
const msg = `Thank you for your submission, ${name.split(" ")[0]}.
Name:${name}
Age:${age}
Address:${address}
Telephone:${phone}
Email:${email}
Your chosen processor speed is ${a4} ${a5}.
With the following additional components:
${a1}${a2}${a3}
`;
alert(msg);
}
}
index.html
Name:
Age:
Address:
Telephone:
Email:
Tick all of the components you want include on your laptop:
DVD_ROM
Card Reade
External Hard Drive
Select the processor speed you requir:
2.6GHz 6-core
2.4GHz 8-core 4.4 GHz
Hover your mouse over this paragraph to see jquery in action
jquery-3.5.1.js
*!
* jQuery JavaScript Li
ary v3.5.1
* https:
jquery.com
*
* Includes Sizzle.js
* https:
sizzlejs.com
*
* Copyright JS Foundation and other contributors
* Released under the MIT license
* https:
jquery.org/license
*
* Date: 2020-05-04T22:49Z
*
( function( global, factory ) {
"use strict";
if ( typeof module === "object" && typeof module.exports === "object" ) {
For CommonJS and CommonJS-like environments where a proper `window`
is present, execute the factory and get jQuery.
For environments that do not have a `window` with a `document`
(such as Node.js), expose a factory as module.exports.
This accentuates the need for the creation of a real `window`.
e.g. var jQuery = require("jquery")(window);
See ticket #14549 for more info.
module.exports = global.document ?
factory( global, true ) :
function( w ) {
if ( !w.document ) {
throw new E
or( "jQuery requires a window with a document" );
}
return factory( w );
};
} else {
factory( global );
}
Pass this if window is not defined yet
} )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1
throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode
arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common
enough that all such attempts are guarded in a try block.
"use strict";
var a
= [];
var getProto = Object.getPrototypeOf;
var slice = a
.slice;
var flat = a
.flat ? function( a
ay ) {
return a
.flat.call( a
ay );
} : function( a
ay ) {
return a
.concat.apply( [], a
ay );
};
var push = a
.push;
var indexOf = a
.indexOf;
var class2type = {};
var toString = class2type.toString;
var hasOwn = class2type.hasOwnProperty;
var fnToString = hasOwn.toString;
var ObjectFunctionString = fnToString.call( Object );
var support = {};
var isFunction = function isFunction( obj ) {
Support: Chrome <=57, Firefox <=52
In some
owsers, typeof returns "function" for HTML