You are developing application web form by using HTML5 and JavaScript.
You need to prevent users from submitting form data more than once.
Which code segment should you use?
Answer : A
* this, in disable(this), refers to the clicked button.
* The disabled attribute is a boolean attribute.
When present, it specifies that the <input> element should be disabled.
A disabled input element is unusable and un-clickable.
The disabled attribute can be set to keep a user from using the <input> element until some other condition has been met (like selecting a checkbox, etc.). Then, a JavaScript could remove the disabled value, and make the <input> element usable.
You develop a web application by using jQuery. You develop the following jQuery code: (Line numbers are included for reference only.)
The web application exposes a RESTful web API that has an endpoint of/product/create.
You need to create a new product by using AJAX.
Which code segment should you insert at line 05?
Answer : D
* url: /product/create
This is the endproduct.
* datatype:
The type of data that you're expecting back from the server.
* contentType (default: 'application/x-www-form-urlencoded; charset=UTF-8')
You develop an HTML5 application that allows users to upload files from their local computers.
The user interface must remain responsive during the upload.
You need to implement the file upload functionality for the application.
Which two actions should you perform? (Each correct answer presents a complete solution. Choose two.)
Answer : B, D
B: Example (notice the web storage api upload.aspx):
<!DOCTYPE html>
<html>
<head>
<title>Upload Files using XMLHttpRequest - Minimal</title>
</head>
<body>
<form id='form1' enctype='multipart/form-data' method='post' action='Upload.aspx'>
<label for='fileToUpload'>Select a File to Upload</label>
<input type='file' name='fileToUpload' id='fileToUpload' onchange='fileSelected();'/>
<input type='button' onclick='uploadFile()' value='Upload' />
</form>
</body>
</html>
D:
* Because we're using XMLHttpRequest, the uploading is happening in the background. The page the user is on remains intact. Which is a nice feature to have if your business process can work with it.
* The XMLHttpRequest object has gotten a facelift in the Html5 specifications. Specifically the XMLHttpRequest Level 2 specification (currently the latest version) that has included the following new features:
Handling of byte streams such as File, Blob and FormData objects for uploading and downloading
Progress events during uploading and downloading
Cross-origin requests
Allow making anonymous request - that is not send HTTP Referer
The ability to set a Timeout for the Request
You develop an application in HTML5. The application has a field named field1 that uses the month input type.
You need to identify what will occur if the application runs from a browser that does not support the month input type.
What should you identify?
Answer : A
References:
https://stackoverflow.com/questions/18020950/how-to-make-input-type-date-supported-on-all-browsers-any-alternatives
You are creating a rotating image of a company logo.
The logo must spin on a horizontal axis and on a vertical axis.
You need to use the least amount of development effort to meet the requirement.
What should you do?
Answer : C
CSS3 allows you to format your elements using 3D transforms.
There are two 3D transform methods:
rotateX() - With the rotateX() method, the element rotates around its X-axis at a given degree.
rotateY() - With the rotateY() method, the element rotates around its Y-axis at a given degree.
You are developing a web form that includes the following HTML.
You need to ensure that a value is entered into txtValue before the form is submitted.
Which code segment should you use?
Answer : A
* Input Text Object Properties include:
value: Sets or returns the value of the value attribute of the text field
* Check if text is a null value or an empty string.
Incorrect:
not .get(): there is no input text object property get.
You are developing an HTML5 page that has an element with an ID of logo. The page includes the following HTML.
Logo:
You need to move the logo element lower on the page by five pixels.
Which lines of code should you use? (Each correct answer presents part of the solution. Choose two.)
Answer : A, B
* style.position = 'relative';
The element is positioned relative to its normal position, so 'left:20' adds 20 pixels to the element's LEFT position.
* For relatively positioned elements, the top property sets the top edge of an element to a unit above/below its normal position.
Example: Example
Set the top edge of the image to 5px below the top edge of its normal position:
img {
position: relative;
top: 5px;
}