You want to include in your form a button labeled Edit, which changes to Save when in edit
mode and changes back to Edit when the form contents are saved. You are calling a function
from the onclick event handler to perform this task. Which of the following is the correct code
for that function? - Answers if(myButton.value =="Edit") {
myButton.value = "Save";
}
else{
myButton.value = "Edit";
}
Which of the following is a valid variable name in JavaScript? - Answers sink
Which of the following correctly defines an object with a property called height, a property called
width, and a method called getArea? - Answers function objRectangle(height, width) {
this.height = height;
this.width = width;
this.getArea = getArea;
}
Consider the following expression:
x = 25;
y = 10;
Which statement would evaluate to true? - Answers x > = y;
You work for a mid-size company with a large Web site that has a very wide customer base.
Which is the best method for testing your JavaScript code for this site? - Answers Test in
various browsers, versions and operating systems.
Consider the following code:
<script type="text/javascript">
, var v1 = "Blue";
function f ()
{
this.v1 = "Green";
alert (this.v1);
}
f();
alert (v1);
</script>
What is the expected result when this script is run in the browser? - Answers Two alert boxes,
both displaying Green
What is a pop-up blocker? - Answers A browser-level security feature
Consider the following statement:
Cookies can be used to store passwords so authentication is not necessary for returning users.
Which of the following choices about this statement is accurate? - Answers The statement is
true, but this practice poses a security risk.
Which code will correctly declare the calendarYear variable as a date object? - Answers var
calendarYear = new Date();
Consider the following code:
<html><head>
<script type="text/javascript">
function validatePhone(phoneField) {
var pattern = /[A-Z]/;