Back

JavaScript

Introduction
HTML (HyperText Markup Language) and CSS (Cascading Style Sheets) are two of the main tools for designing and and displaying websites and web pages. If they are combined with a client-side processing language like JavaScript to add dynamic and interactive content, then websites can be built that are clear, memorable, useful, informative, accessible, organised and maintainable. This section deals with JavaScript.

What is JavaScipt?
JavaScript is an object oriented programming language, although it can also be used as an imperative language as well. It is most commonly used to write client-side scripts in web pages. These allow a visitor to a web page to interact with it and to allow dynamic data changes on the web page. Don't confuse JavaScript with Java, by the way! They are two different languages, and used for different things. 

What JavaScript do OCR students need to know for the AS and A Level qualifications?
According to the OCR Specifications, "learners are expected to be able to follow and write basic JavaScript code. It is hoped they will get practical experience of JavaScript in their study of the course. They will not be expected to commit exact details of syntax to memory. Questions in the exam will not penalise learners for minor inaccuracies in syntax. Learners will be expected to be familiar with the JavaScript equivalents of the structures listed in the pseudocode section (with the exception of input and output (see below). They will not be expected to use JavaScript for Object Oriented programming or file handling. Questions will not be asked in JavaScript where something is passed to a subroutine by value or reference is relevant." 

Input
Input will be taken in by reading values from a form. NB learners will not be expected to memorise the method for doing this as focus will be on what they do with that input once it is received. 

Output 
By changing the contents of an HTML element

chosenElement = document.getElementById(“example”);
chosenElement.innerHTML = “Hello World”;
By writing directly to the document
document.write(“Hello World”);
By using an alert box
alert(“Hello World”);
Any other JavaScript used will be explained in the question.

JavaScript tutorials
There are many excellent tutorials available on JavaScript and if you already have a website, you will be up and running in no time. Try these or search for 'JavaScript tutorials':

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

http://www.echoecho.com/javascript0.htm

http://www.lissaexplains.com/javascript.shtml

https://www.youtube.com/results?search_query=JavaScript+tutorials 

Back