A scripting language is a form of programming language that is used to create scripts or bits of code.
Scripting languages are often written to facilitate enhanced features of websites, these features are processed on the server but the script of a specific page runs on the user’s browser. The origin of the term was similar to its meaning in “a movie script tells actors what to do”: a scripting language controlled the operation of a normally-interactive program, giving it a sequence of work to do all in one batch. For instance, one could put a series of editing commands in a file, and tell an editor to run that “script” as if those commands had been typed interactively. Advantages of scripting language It’s easy to learn and use Minimum programming knowledge or experience required Allows complex tasks to be performed in relatively few steps Allows simple creation and editing in a variety of task editors Allows the addition of dynamic and interactive activties to web pages The editing and running code is fast Disadvantages of scripting language Can be slower to run since they are interpreted and not compiled into machine code. Can be harder to debug since no development environment is available by default. Since they are text based it is easy for other people to modify and thus break it.
Why modern web pages use javascript? Browser support- To access flash content you need to install flash plugin into your browser. But to use Javascript you dont need to install a plugin for it, becuase all web browsers have accepted javascript as a scripting language for them and provides support for it. With the use of javascript you can add various features like user authentication, validation etc Javascript easily reads and writes HTML elements and can be embedded into a HTML easily. You can use Javascript to load the page according to the requirement of the browser It is the most light programming language which can be easily loaded on slow internet. An action event can be created with the use of javascript, when a user clicks a button, various events which is not possible through HTML: Javascript has the ability to react on it.
Explain the following features of JavaScript, giving an example of each: Objects – Javascript has built in objects, some of them are string, date and array. Events – A JavaScript can be executed when an event occurs, like when a user clicks on an HTML element. These events can occur when a user clicks the mouse, when a web page has loaded and when an image has been loaded. Methods – There are a lot of javascript methods, some of them are anchor, apply, attend, big and blind. Each of these methods are different, for example an anchor method places an HTML anchor that has a NAME attribute around text, an apply method applied a method of an object substituting another object for the current object.
Loops – Javascript loops often runs with arrays these loops are used to run the same code over and over again, each time with a different value. For example in javascript for is a loop that loops through a block of code a number of times, while loop, loops through a block of code while a specified condition is true. Functions – Javascripts has many functions some of them are abs, acos and asin. Each of these methods are different.
Abs function returns the absolute value of a number, an acos function returns the arccosine of a number. JavaScript is an object orientated language. Describe what this means. Is JavaScript object-oriented? It has objects which can contain data and methods that act upon that data. Objects can contain other objects.
It does not have classes, but it does have constructors which do what classes do, including acting as containers for class variables and methods. It does not have class-oriented inheritance, but it does have prototype-oriented inheritance. The two main ways of building up object systems are by inheritance (is-a) and by aggregation (has-a). JavaScript does both, but its dynamic nature allows it to excel at aggregation. JavaScript is not truly object oriented because it does not provide inheritance. But it turns out that JavaScript supports not only classical inheritance, but other code reuse patterns as well.
Task 2 – M2Explain in detail how scripting languages can be used to improve the functionality of web pages. Scripting languages, which can be embedded within HTML, commonly are used to add functionality to a Web page, such as different menu styles or graphic displays or to serve dynamic advertisements. These types of languages are client-side scripting languages, affecting the data that the end user sees in a browser window. Why use Scripting Languages? Quite often we wish to automate a simple task – running several programs in a row, installing programs, even writing a simple script or GUI to run a program that needs many parameters. Scripting languages allow us to write such a thing quickly, and run it without any compilation. They also have good support for launching processes and controlling them, parsing text files, etc.
With a script, there’s never the question of “where is the source?” or “did i re-compile it after i fixed that bug?” – the script _is_ the source. Client side and Server side Client side In Client side the scripting does all the calculations on the user’s computer. The web browser or a specific plugin reads the script and converts it into a visual web page. Front end context uses scripting through a user interface. There are many ways a user interface uses scripting one is that it resizes parts of the webpage to make it all fit properly.It also resizes boxes.
Most of the information that the user enters into the website stays in the client side and sometimes sent back to the server. Javascript can obtain external files and images. It then exploits all of this using web analytic programs, the server can retrieve all the information from all of these. The difference between client side aˆ?aˆ?aˆ?aˆ?aˆ?and server side The difference is fairly simple client side code is processed by the client (the browser to be more specific) while the server code is processed by the server . A typical web page as far as the client is concerned consists of some of HTML implemented by CSS, or Javascript.
Server side code, on the other hand is never seen by the browser. The browser is not and should never need to be aware of server side scripts such as PHP. Server side code is browser independent which means that if the page you create looks different in internet explorer than it does in opera. Client Side advantages Allow for more interactivity by immediately responding to user’s actions May improve the usability of web sites for users who’s browsers support scripts Can give developers more control over the look and behaviour of their web widgets Secure as it is protected which means it is not possible to read by users, prevents it from being stolen Client Side disadvantages Not all browsers support scripts therefore users might experience errors if no alternatives are provided Different browsers and browser versions support scripts differently thus more quality testing is required More development time and effort might be required Server side advantages Complex processes become more efficient Does not need to rely on specific browsers or plug ins You can make a webside dynamic, PHP a server side scripting language have features such as you can to add a username and password Server side disadvantages Less immediate Can slow down your web site E.g. AJAX, accessibility, alerts, confirming choices, prompting the user, redirecting the user, browser detection, creating rollovers, checking/validating input, handling forms, maintaining cookies Task 3 – P5 (b)Design interactive scripts using scripting languages (JavaScript) that can be embedded onto the website created in assignment 1.
Select 2 of the following (you may choose your own if you wish) that you must include into a minimum of two web pages: JavaScript slideshow Random image generator Browser version/type detection Software plug-in detection Feedback form using JavaScript validation For each of your chosen scripts produce: Design:A flow chart or Pseudo code Implementation:Annotated screen shots of the scripts in action on the web pages. Correct structure of HTML code which includes correct indentation of the code and well commented. M3 (b) Printouts of the scripts Testing: P6 (b)A test table containing the variables being tested, test data, expected results and actual results. Task 4: D1Investigate and produce a report (minimum 1 page) that explains at least three examples of how web pages using scripts are implemented differently in two different browsers, for example, Internet Explorer and Firefox. Browser capabilityBrowsers have varying levels of compliance with Style Sheets.
This means that some Style Sheet features are supported and some aren’t. To confuse things more, some browser manufacturers decide to come up with their own proprietary tags. Fortunately, browser compatibility is becoming less of an issue as the latest browser versions are much more standards-compliant than their earlier counterparts. Browser capability is a headache for Javascript coders around the world. There are two ways to allow conditions within your script such as Javascript to take different paths depending on capability These two ways are: 1.
Browser detection 2. Object detection Browser detectionBrowser detection checks with the browser directly to see which make and model it is. This allows you to choose which code to run on your browser. Browser detection is capable of working out the browser and version being used. This allows the web page to use the right code which is to visually display.
Browser detection coding function thisBrowserIs(browserTest){ if(navigator.userAgent.indexOf(browserTest)!=-1){ return true; }}This is an example of browser detection coding. This code means that if it can find the string being passed to this function within the navgator user agent property, then return true Object detectionObject detection allows you to check if an aspect of the script language definition exists before trying to use it. It means that the script can detect whether certain objects can work with a specific browser. Object detection example: if (document.
images) {do something with the images array }Separate style sheets You want to make sure that your style sheets works on most internet browsers. There is different coding with different browsers. Creating Separate Style Sheets for Internet Explorer and Firefox IE and Mozilla handle CSS instructions differently. It can be annoying but, there is a way to get around it. Make multiple style sheets, one for each type of browser. Then customize each style sheet for it’s corresponding browser.
Create two style sheets, one for IE browsers) and one for every other kind of browser Tell Internet Explorer to use a separate style sheet by inserting the following code between your header tags. Change the name and path of the css files to that of the css files on your site. The code must appear in this order. Task 5: D2Write a report that evaluates the website that you have created stating good points, bad points and discuss at least four different methods that could be used to improve the created web site. I created a website to a book shop called Harlington book store.
It took me 3 weeks to completely finish the website with all the books and prices. As I had previous experience in creating websites this website was quite enjoyable to create. I used three main colours on my website so it would look more professional and creative. I included 9 pages to this website and I have created a menu bar so the user can navigate to these pages. To make this website user friendly I have created alt tags and I have checked the browser capability of the website.
During this period I had many problems creating the website such as I had to upload the books one by one with prices and for each book I had to download the book cover. This took me more than a week to finish all the books. Another problem I faced was when I had to resize all the images of the book to the same size. Uploading the books were the most hated part when creating this website apart from that creating the website was very enjoyable. One thing to improve this website would be to create a database so when updating the books can be automatically uploaded on the website instead of uploading on the website itself.
Checklist for Assignment 2: JavaScript ImplementationContentY/NCommentsTASK 1:Describe the main features of the chosen scripting language (P3)Explain what a scripting language is and why is it used in the modern web pages Objects Events Methods Loops Functions JavaScript is an object orientated language. Describe what this means. TASK 2:(M2)Explain in detail how scripting languages can be used to improve the functionality of web pages. TASK 3:Design, create and test web pages using scripts to implement interactivity.
(P5 b) (P6 b) (M3 b) Script 1:A flow chart or Pseudo code Screen shots of the scripts in action on the web page. Comment and indent your code Printouts of the scripts A test table for the script Script 2:A flow chart or Pseudo code Screen shots of the scripts in action on the web page. Comment and indent your code Printouts of the scripts A test table for the script Task 4:(D1)How scripts are implemented differently in two different browsers. (3 Examples) Task 5:(D2)Website Evaluation