to home page

BWRS
SEARCH

HOMETUTORIALSLINKSFORUMGLOSSARYNEWS
 

JavaScript

JavaScript
 

JavaScript is pretty common on the web these days. It can provide dynamic effects ranging from this last updated note

To this loan calculator

Car Purchase Plan
Please not this is a fun example and not a serious form for calculating car loans
Total Car Price ()
Deposit ()
Annual Interest Rate: %
Loan Length Years
The costs
Outstanding loan ()
No of Payments Months
Deposit ()
Monthly Cost ()

to this dynamic roll over effect

JavaScript comes from the stables of Netscape. Unlike its name sake Java, it is interpreted language in that doesn't need to be translated or compiled its reader simply executes each line as it comes to it (much like a moviescript). The reader JavaScript's case (no prizes for guessing) is your browser.back to the top

JavaScript is embedded within an HTML document

With Frontpage express all you do is Insert -> Script. Remember to tick off (A) JavaScript and then simple just type your script in the box (B)

Script Box

The next line of text is a simple example of a JavaScript

To get this to work just enter this into your script boxback to the top


document.open ();
document.write("If your browser is Javascript enabled it can see this");

Frontpage express will handle the tags and ensure non JavaScript browsers will not trip up

here is the script for the last updated script

document.write("<i>"+"Last Updated -" +document.lastModified + "</i>");

(for a better explaination of the code visit our last update cool tip)

Normally you'll usually see scripts in the following forms of

<script>
document.open ();
document.write("If your browser is Javascript enabled it can see this");
</script>

OR

<script>
<!--//
document.open ();
document.write("If your browser is Javascript enabled it can see this");
-->
</script>

You only want the middle 3 linesback to the top

e.g.

document.open ();
document.write("If your browser is Javascript enabled it can see this");

Frontpage express will actually add in

<script>
<!--//

and

-->
</script>

Sometimes a <noscript> tags are used as well. These are for browser which aren't JavaScript enabled.

e.g.
<noscript>
sorry need a JavaSCript enabled browser
</noscript>

This isn't script and should be added as insert HTML

Sometimes it's easier to add a whole script (including <script> etc.) using insert HTML especially if you need to add complex elements like forms as well or if it needs to go between <head> tags.

Many others sites can teach you how to write JavaScript and you'll find examples on this site and on the web to copy and paste into your HTML documents. Check our cool tips and links for some start points. As with everything check the copyright and make sure it's not a malicious script

If you haven't done so take a look at our Java tutorial which covers a another web based language. Unlike JavaScript it runs from a seperate link applet fileback to the top

Back to advanced tutorial index
BACK TO ADVANCED TUTORIAL INDEX