Home » Scripting Types and Uses

Scripting Types and Uses

A different type of scripting and their uses are;

Save Time On Research and Writing
Hire a Pro to Write You a 100% Plagiarism-Free Paper.
Get My Paper

Maintaining cookies – Website uses cookies to allow the user to use the website easily for example cookies will give your preference when visiting that website and gives you recommendations when buying things for example when buying things from the internet it will give you preferences to allow shopping much easier.

Checking and validating input. – The use of checking and validating input is when for example for searches or to check a certain box has been filed in correctly with the right information.

Browser detention – Browser detection is when a user types a website in the search bar and it shows recommendation of what you might be searching and it will show different types of searches to save you time and effort.

Some old browser does not support JavaScript and can cause problems when inserting code as the browser will not recognise and understand JavaScript. And it will just show a bunch of code into the webpage when loading it.

Save Time On Research and Writing
Hire a Pro to Write You a 100% Plagiarism-Free Paper.
Get My Paper

To avoid this note script allows HTML to ignore the comment that the user has inputted so that it will not show on the web page.

JavaScript is an object orientated and event driven.

Nature of languages

Procedural- line by line and it write instruction and the computer just have to read it.

Event driven – Event driven is when a button is being executed by clicking that button. For example;

Object oriented language mean that the codes are broken down into objects or pieces and each objects has its own properties.   

Inserting script

You can add script element to any HTML document by adding extra code into the page. You can add the JavaScript on the head section, body section as long as you have an opening script and a closing script or else it would not work when opening it in a web browser as it would just show you bunch of codes. And also you would need to have a script type to be to tell the web page that it is a script.

Object -Most things in JavaScript is an object e.g Boolean, numbers. An object is a type of data which has its properties own and knows how to trigger it methods.

Example

var person = {firstName:”John”, lastName:”Doe”, age:50, eyeColor:”blue”};

Example from – http://www.w3schools.com/js/js_object_definition.asp

Method – A method is a collection of statement that are grouped, methods are actions that can be performed on objects. The document write means is to output a message on the screen and it could be value or text.

  • Write() – This will write something directly into a html page e.g.
  • Click() – this can be a radio button that user can select and click, e.g. Male or female.
  • open() – this is to open up new browsers or a new tab. This can be used if the user will need to have to go on a external website e.g. windows.open(“www.google.co.uk“)

Properties – properties are building block of objects. There are many types of properties in JavaScript. Here is an example of a property using JavaScript.

Example from surfside website.

Handling events

Events are things that happen to a HTML element. JavaScript can react to many events. Events are things that can happen in a browser. If an event is detected, then multiple thigs can happen in the browser e.g. a function might be triggered e.g. pressing a button. These are some of the main event;

  • Onclick – this will activate when a HTML element has been click by a user.
  • Onmouseover – this is triggered when the user hovers their mouse on a HTML element.
  • Onload – this is triggered when the page has finished loading.
  • Onkeydown – this is triggered when the user presses the down arrow on the keyboard.

A function is a piece of script that be called when the script is run.

For example

A function in JavaScript us defined with a function keyword, with a name, and parentheses (). Functions names can contain letters, numbers, and different types of symbols. The code can be executed if the code is inside a curly bracket {}.

function name(parameter1, parameter2, parameter3) {
code to be executed
}

Example is taken from – http://www.w3schools.com/js/js_functions.asp

We use functions because we can reuse the code (define the code once and use it again as many times as the user wants).

You can use the same code many times with a different argument.

Hiding scripts – Scripting language are not support in older browsers or updated browsers. Updated and newer browsers will know what’s going in between the script, while older browser will not know. You can also comment to hide the script.

Note script

HTML:

CSS: /* comment */

JavaScript: //

You can also disable the script in the browsers settings.

What we mean about the interaction and the use of client side scripting for web pages is that the client side uses a browser to connect to a static web pages that uses HTML and CSS that allows them to interact to the website. And that scripting allows the website to have interactivity to a user and make it dynamic. For example, when a client requested information from the website e.g. looking for a holiday.

Variable is a container that holds a value or it can be a whole text and data. It can be change anytime

var namefield=detailsform.fullname.value;

value

variable

event.returnValue-false;

this means that the event which is submitted cannot be executed if box or container has no value.

Security issues

One of the most common security problems of JavaScript is Cross-Site Scripting also known as XSS. Cross-Site Scripting enables the attackers to change the website to return a malicious script to user going on that website. As JavaScript is an object oriented scripting language, hackers can use tools such as XSS to write their code and harm the user’s machine and their information stored in the machine. The difficult thing about JavaScript malicious code is that it is hard to detect security breaches that are happening because it’s usually happening inside the website or inside the user’s machine without any warnings.

https://www.veracode.com/security/javascript-security

The HTML element tag we use to implement script is with an opening script .
If the user wants to run the same script in a different html page, then it should be best to put the JavaScript in one folder so that the user doesn’t have to rewrite in all over again. You have to save the script file with a.js extension and you have to refer to it using the src attribute in the script tag.

For example;

Loops

Example of loops – example taken from Moodle.

Loops is beneficial when you want to run the same code over and over again with different values.

The For loop is the tool when you want to create a loop

for (statement 1; statement 2; statement 3)

{

code block to be executed

}

Statement 1 – this is executed before loop even start (code block)

Statement 2 – defines the conditions for running the room

Statement 3 – is executed each time the loop has been executed.

http://www.w3schools.com/js/js_loop_for.asp

A IF statement is a control statement that will allow the JavaScript to make decisions;

For example;

We use the if conditions if the specified condition is true.

We use the else conditions if the same specified condition is false.

The dot operator is used to as a separation technique which separate the objects from their methods and properties.

Functions are pieces of code that can be written separately or within the ‘




Place your order
(550 words)

Approximate price: $22

Calculate the price of your order

550 words
We'll send you the first draft for approval by September 11, 2018 at 10:52 AM
Total price:
$26
The price is based on these factors:
Academic level
Number of pages
Urgency
Basic features
  • Free title page and bibliography
  • Unlimited revisions
  • Plagiarism-free guarantee
  • Money-back guarantee
  • 24/7 support
On-demand options
  • Writer’s samples
  • Part-by-part delivery
  • Overnight delivery
  • Copies of used sources
  • Expert Proofreading
Paper format
  • 275 words per page
  • 12 pt Arial/Times New Roman
  • Double line spacing
  • Any citation style (APA, MLA, Chicago/Turabian, Harvard)

Our guarantees

Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.

Money-back guarantee

You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.

Read more

Zero-plagiarism guarantee

Each paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.

Read more

Free-revision policy

Thanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.

Read more

Privacy policy

Your email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.

Read more

Fair-cooperation guarantee

By sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.

Read more
Live Chat+1 763 309 4299EmailWhatsApp

Order your essay today and save 15% with the discount code ESSAYHELP