Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need help with my JavaScript project. CMPS 1 6 2 : Module 8 Programming Project * { font - family: monospace; } / /

I need help with my JavaScript project.
CMPS 162: Module 8 Programming Project
*{ font-family: monospace; }
//------------//
// Exceptions //
//------------//
console.log("Exceptions");
//1. Chapter 87. The if statement below will throw an error (myVar is
// not defined). Wrap the if statement in a try catch block that logs
// the string "an error occurred." to the console.
if (myVar===true){
console.log("x is true.");
}
//-----------------//
// Form Validation //
//-----------------//
console.log("Form Validation");
//1. Chapter 82. Implement the validateName function that should get the string
// from the "name" input field and check to see if a value was provided. The
// results should be reported to the user in the status div.
// a. The "name" field's value should be more than 1 character long.
function validateName(){
// implement your program here
//...
// If the value passes the test, set the innerText of the statusDiv to
// "Valid name".
// If it does not pass the test, set the innerText of the statusDiv to
// "Invalid name".
}
//----------------//
// More On Events //
//----------------//
console.log("More On Events");
//1. Chapter 89. Attach onfocus and onblur events to the "name" field below using
// only JavaScript, i.e., do not modify the HTML. Change the background of the
// text input field on these events.
// a. When the "name" field gets focus, the style.backgroundColor should be set
// to pink.
// b. onBlur, the style.backgroundColor should be set to white.
// TIP: create one function that sets the input field's background color to pink
// and another function that sets the input field's background color to white.
// put your background color functions here.
window.onload = function(){
// assign the onblur and onfocus event handlers here.
};
See console!

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Learn To Program Databases With Visual Basic 6

Authors: John Smiley

1st Edition

1902745035, 978-1902745039

More Books

Students also viewed these Databases questions