
JavaScript
This page assumes that you already have some knowledge of JavaScript and that you wish to expand your skills.
- When writing JavaScript, you should remember that a small percentage of user machines cannot run JavaScript and provide an alternative page.
- JavaScript is a language that runs on the users computer. In order to protect your customers, Javascript has built in safeguards and you cannot
read or write files on their machine using this language. It is possible to incorporate a text file into the program code
by assigning each line of the file to an element in a variable array.
var lineoffile = new Array();
lineoffile[1] = "first line of file";
lineoffile[2] = "second line of file"; - JavaScript is not suitable for processing sensitive data or logon scripts. It is easy for a hacker to view the JavaScript code and reveal sensitive data.
- Many JavaScript textbooks concentrate on creating page content using document.write("......"); The moment JavaScript sees document.write, it assumes that you want to create a new page and you loose one of the key features of the language. If you create a page using HTML and ensure all the major tags have class attributes - you can then use JavaScript to dynamically change page content in response to user activity. The quizzes in my Pembrokeshire and Weston-super-Mare webites illustrate the power of this technique.
-
Internet Explorer can display a prominent warning message to your readers whenever they view a page with any JavaScript
content. This advises users that the page could contain dangerous content and many readers rapidly click away from your site. In order to prevent this problem
you need to include a special line near the top of your <head> section.
<!-- saved from url=(XXXX)http://YYYYYY/ -->
Where YYYYYY is the website address (starting www. and ending .com, .co.uk or whatever.) and YYYY is a four digit number, padded with leading zeros, which is the exact number of letters from the h of http; to (and including) the final /.
Suppose your site is www.ab.com, this text would be <!-- saved from url=(0014)http://ab.com/ --> (For further information, look up "Mark of the Web" using a search engine.)
DigitalDan.Eu is part of the DigitalDan.co.uk group