NEW
Font size
WorksheetsuCertify JavaScript Chapter 9 and 10
Total questions: 21
Worksheet time: 11mins
Which of the following methods returns an array of all the elements in a Webpage, with a specified class name?
getElementsByName
getElementsByTagName
getElementsByClassName
getElementByClassName
Which method allows you to delete entire HTML attributes from an element?
getElementById
setAttribute
innerHTML
removeAttribute
Which method retrieves the corresponding value of an attribute?
getAttribute
setAttribute
removeAttribute
innerHTML
Which of the following methods will access all occurrences in the page of an element with a specified name value and return them in an array?
getElementsByTagName
getElementById
innerHTML
getElementsByName
Which line of code will center <div id="mydiv"> on the page?
document.getElementsByName("mydiv").setAttribute("align", "center");
document.getElementById("mydiv").getAttribute("align", "center");
document.getElementsByName("mydiv").getAttribute("align", "center");
document.getElementById("mydiv").setAttribute("align", "center");
Which of the following methods lets you access all occurrences of an HTML tag in a Webpage?
getElementByID
getElementsByName
getElementsByTagName
innerHTML
Which method will return only the first occurrence of a specified element in a script, rather than finding all occurrences of a specified element and returning them in an array?
getElementsByTagName
getElementById
innerHTML
getElementsByName
In Web development, what is the ability to change HTML "on the fly"?
To change Webpage content from X/HTML to JavaScript
To change HTML on a Webpage when needed, even after it renders
To change a Website from static content to interactive content
To change Webpage content by requesting user input
What happens if your script runs the document.write method after the page is rendered (i.e., finished loading)?
*hint* 9.7 Appending Text to the DOM
It will append the document.write content to the end of the page without overwriting the existing page content.
The document.write content will not be added to the page at all.
It will remove all content and code that was previously on the page and render only the document.write content.
It will append the document.write content to the beginning of the page without overwriting the existing page content.
Which method dynamically modifies the value of an element's attribute?
setAttribute
getAttribute
removeAttribute
getElementById
What two parameters does the setAttribute() method take?
3.1: Modify HTML with JavaScript.
The name and the id of the attribute to retrieve
The name of the attribute to set and its new value
The name of the element and the attribute to set
The name of the attribute to remove and its replacement attribute
Which of the following protocols is used to protect the user data during transmission?
SSL
SSH
IPsec
HTTPS
Which property of the form object returns the number of elements in the form?
target
encoding
elements
length
Which of the following methods of an HTML form object removes focus from an input element?
autofocus()
focus()
blur()
remove()
Which two objects are not supported on the Safari browser?
email and URL
email and search
color and URL
Which example shows proper JavaScript syntax for referring to a form object named newForm having a text box named fieldName?
form.newForm.fieldName."value"
document.newForm[fieldName].value;
document.newForm.fieldName.value;
window.newForm.fieldName.value;
Which of the following should be done while adding validation to a form?
Test multiple fields in one validation.
Test the form validation on a single browser.
Validations should not override each other.
Alert messages should be discursive.
Which event handler of the select object specifies the JavaScript code to execute when a user moves the cursor to the select list?
onsubmit
onblur
onchange
onfocus
Which property is not supported by the hidden object?
autofocus
type
value
name
In JavaScript, what is the purpose of the form object?
To access all properties of a form
To replace the HTML <form> tags
To enclose the HTML <form> tags
To represent all the forms in a single Website
Which property is not supported by the hidden object?
autofocus
type
value
name
