What are scripts?

Scripts are something which are discussed quite frequently in articles on Web design, but if you are a newcomer to this field then you might not be sure what exactly what the term means. Well, basically a script is a short piece of code which is included in a design for a page which will alter the way that an Internet browser interprets the rest of the HTML which is given. This then results in something called Dynamic HTML (DHTML). There are two different types of script which may be used – client-side scripts and server-side scripts.

Client-side scripts are sent to the browser in the code form and the Internet browser which is being used will then interpret what is there and change the HTML accordingly. Client-side scripts may be used for functions such as inserting the date and time onto a page. They may also be used where the content of the page which is showed should change according to the actions of the user. For example if an image on the page needs to change when a user places the cursor over the image then a client-side script would be used. Most of the client-side scripts which are used by sites use the JavaScript language, but some use others such as Visual Basic Script (VBScript).

Most client-side scripts take the form of embedded scripts, which means that they are just written into the HTML which is used to code a page. If the script is quite complex it may however be stored in a separate file which is then downloaded by the browser for use.

The main advantages of using client-side scripts is that it does not matter what is or is not supported by the Web host server as the interpretation of scripts is done by the browser which the visitor is using, not the server. At the same time this may however cause problems if the visitor is using a browser which is not compatible with the scripts used. This will result in the pages not being displayed as intended, and it may also interfere with the usability of the site.

A server-side script relies instead on the server to interpret the script which is used, and then send on the information in a format which all browsers can read, usually HTML. This is usually the type of script which is used when an interface with a database is required, for example when shopping carts are included on a site. PHP, Perl and ASP are the most common languages used to write these scripts, with PHP and Perl used predominantly on UNIX or Linux-based servers and ASP on Windows-based servers.

The advantage of using these server-side scripts is that the page will be displayed the same for the user, regardless of the browser’s ability to interpret a particular script. The disadvantage is however that the server needs to be able to interpret the script, and not every server is able to interpret every script used. This means that it is imperative that the compatibility of a script with your Web host is checked before you embark on writing these into your design.