Fichas
Advanced Web Scripting
Fichas del conjunto (22)
- 1What is abstraction?Abstraction is the process of removing the details from the main page so the developer can focus on one thing at a time
- 2What are the benefits of using abstraction?1. A developer can focus on one part of the development at a time.
2. It reduces duplication of code
3. It keeps code neat and tidy
4. If more than one developer is working on the same project, they can easily find the specific part of the code they need - 3In web development, how would you use abstracton? (which languages and methods)Javascript and CSS are typical examples of abstration. It is easy for a developer to change an aspect of he javascript if it is stored in a separate file making it easier to find. Javascipt for example can be abstracted from the main html page of a website. You firstly move it to the header, then nto functions, then move it into a completly separate file with a script tag in the origional html code with a link to the file.
- 4What is Graceful Degradation?The opposite of progressive enhancement. It is a development technique where the developer builds for the most current browser but then develops handlers incase older browsers can not run the script
- 5What is progressive enhancement?It is the opposite of graceful degradation. It is when the developer starts wih a simple html page that all browsers will be compatible with and then adds functionality for those with better browsers that support it.
- 6What does AJAX stand for?Asynchronous Javascript and XML
- 7What is unobtusive javascript?It is a technique that should be used to develop javascript. It has 3 principles:
1. Abstraction
2.Use best practices
3. Progressive enhancement - 8What des DOM stand for?Document Object Model
- 9What is the DOM?It is an API for HTML and XML. It is a way of defining the structure of a html or xml page. It allows elements of a page to be accessed and manipulated.
- 10What are the 3 parts of DOM?1. Core- the standard any structured document
2. XML DOM - model for XML
3. HTML DOM - model for HTML - 11What are the 4 levels of DOM and what do they include?1. DOM Level 1 - core and html
2. DOM Level 2 - core, events and style. Traversal and Range Specification. Views
3. DOM Level 3 - core, load and save
4. DOM Level 4 - still being standardised - 12How would you find out what level of DOM a browsr has?Object detection.
if(document.implementation)
{if(document.implementation.hasFeature
(‘Core’, ‘2’))
{alert(“DOM2 Core supported”)
//code of DOM2 Core required
} else {
alert(“DOM2 Core NOT supported”)
}
} else {
alert(“No DOM Implementation supported”)} - 13What is the DOM node tree?HTML DOM views an HTML document as a tree structure.
Object = node - 14What code examples can you use to access the DOM?getElementByID
getElementsByName
getElementsByTagname
getElementByClassName - 15WHat code would you use to set an attribute in the DOM?setAttribute(attributeName,Value)
- 16What code would you use to acces the HTML node if there were no text nodes above it?document.childNodes[0]
This would normally be put in a variable so it can be used more than once so:
var htmlNode=
document.childNodes[0] - 17How would you checck to see if the node you hae is the correct one?Alert the node to see.
alert("The selected node is a " + node.nodename + " node")
This will dislpay the node name of the variale node. - 18How would you display the number of child nodes in the document?var docChild= document.childNodes.length
put this into an alert
alert("The document has " + docChild + " children"); - 19How would you display the parent of the html node?var htmlNode = document.childNodes[0]
var parent = htmlNode.parentNode
put into an alert:
alert("The parent of the html node is " + parent); - 20How would you change the style of an element using DOM?document.getElementById("id").style.property=new style
for example:
document.getElementById("test").style.color="blue" - 21What does AJAX stand for?Asynchronous Javascript and XML
- 22What is the XMLHttpRequest object used for?It is used to exchange data with a server and loads the server with the response data back to the script. It allows server requests to be made after the page has loaded
Información
- Descripción
- Degree Advanced Web Scripting Fichas sobre Advanced Web Scripting , creado por elbruce el 05/12/2013.
- Creado por
- elbruce
- Visitas
- 69
- Etiquetas
- Valoración