[Contents]

jsEditor - Boilerplate Code - Blocks

Aim: to gain more familiarity with the jsEditor's boilerplate code

Repeat the previous lesson to insert an alert with JavaScript tags.

Select the whole of the code and right click on the page (or on the HTML button). As the HTML mode is selected by default, clicking on the page will give you the HTML menu. If you select another mode, then the button will become flat and you can get its menu by clicking on the page (as well as clicking on the button!).

Choose Block and Head. (No insult intended) and the code will be surrounded by HEAD tags. (JavaScript should normally be in the HEAD).

Now we do not have a BODY.

Click below the HEAD tags (below </HEAD>) and choose Block and Body. We now have a page with a HEAD and a BODY. The code looks like this:

<HEAD>

<SCRIPT LANGUAGE="JAVASCRIPT">

<!--//

alert("Hello");

//-->

</SCRIPT>

</HEAD>

<BODY>

</BODY>

However, we have forgotten to put the HTML tags in. Select the whole of the code, right-click and choose Block and HTML from the pop-up menu.

We now have an HTML page.

You have learned a little more about boilerplate code.