Unit 20 Client-Side Customisation of Web Pages
ASSIGNMENT 2 Scripting Language template (P3)
Task 1 - Using examples from your practice websites or the internet explain the main features of the JavaScript / jQuery scripting language (P3).
Date: 29/03/2019
1. What is the purpose of a scripting language in web design? (what are scripts used for, what are the benefits to users?}
Answer
Using scripts in web design is there to change the behaviour aspects of the webpage. An example could be an accordion and how that works but then
there are also features of changing the way something looks and displays itself. The benefits are that the styles can be changed so that the website can
be specific to what’s being talked about or what the topic is. Overall, it means that the website is more interactive, instead of just being a stack website.
By this I mean that there can be pop-ups that make the user click on them or it could be something as simple as adding buttons to the page.
2. How can a scripting language be added to a HTML page? (there are 3 methods of adding scripting to a page)
Method Explain how the script is added to the page Screen shot of script code added to the page
External An external style in JQuery is set up in this format, where
you call the script from another file. With the code example
I used it can be called with one line but there are AJAX and
Dynamic loading which can be done differently.
Internal An internal style in JQuery is set up in a format where the
document gets called first and then the code for the
internal style will play. However a ready function can be
added which then can have other things inputted after that.
, Inline The inline style in JQuery, can be done in many different
ways it depends on how much you want to write for it.
With the example I used it makes it so that you don’t need
to use the $(document).ready(function)) as the
DOMContentLoaded event has been used instead.
Briefly explain when and why a doc.ready statement is used?
The doc.ready statement is used when needing to determine the state of a document. The jQuery detects the state of readiness and the code will only
run once the JavaScript code is executed after the statement inside the doc.ready has run.
3. What are selectors, events and effects? – give examples of how each are used in jQuery.
Describe what this does in the jQuery code Screen shot of this being used in jQuery code
Selectors A selector in jQuery code is a function in which makes use of
expressions to find some matching elements based on a criteria.
The selector can be used to select an amount of HTML elements
using jQuery, once an element is selected it can perform various
operations.
Events The events within jQuery are actions that can be detected but a
web application. There are examples like a mouse click, a page
loading, or a keystroke on your keyboard. Once the events are
triggered you can use those custom functions to do whatever you
want with the event.