Professional Documents
Culture Documents
Jamal Al-Attar
Scripting Languages
Scripting languages provide benefits and features for the developer that cannot
be added by something such as HTML or CSS. These features will also benefit the
visitor of the website by performing tasks such as redirecting them to new pages
when old ones are deleted or having validation rules on forms.
Web Servers and Programming Languages
Using scripting languages (specifically JavaScript) is beneficial compared to a
programming language that would run on a web server. This is because
JavaScript can be run locally on the users computer, and no or little data needs
to be sent to and back from the web server. This is advantageous because it
means there will be less stress on the web server, especially if there is a large
amount of users. A small thing such as validation for username length does not
need to be sent to a web server, so it would a waste of bandwidth if it was sent.
This will result in lower costs as a less powerful web server will be required.
P3
Jamal Al-Attar
Here is the code that is used to open a new window it can be linked to any page
that is specified by the developer.
P3
Jamal Al-Attar
Conditio
n
Display if guessed
correctly
Else, display unlucky
message
Functions
A JavaScript function is a selection of code that is created to perform a specific
task when it is called. Functions may sometimes require data that needs to be
input or created before the function works properly. The data values that are
required are called parameters. After the function has been named, the
parameters can be included between brackets afterwards.
This is an example of code that contains two parameters.
Methods
JavaScript methods are functions that are formed to be part of an object. The
most commonly used ones are the following:
Write() Write is often put in conjunction to document (the web page) to
display text on the web page for the viewer. In this code, the web page will
display Hello.
Click() Click is used for detecting mouse clicks by the user. For example, to
detect the user clicking a button, onClick() will be used. This code will detect a
click from the user on a button that says Click me.
Open() Open is used for opening a new window in a browser. The developer is
able to specify which website or link is opened. In this code, a new window is
opened test.html.
P3
Jamal Al-Attar