JavaScript is a language that allows you to inject logic in pages written in HTML (Hypertext Mark-up Language). You have here a brief overview of how JavaScript works in addition to its practical use.

JavaScript logic of the paragraphs may be “loose” or linked to the occurrence of events. Loose paragraphs are executed in the sequence in which they appear on the page (document) and linked to events run only when the event occurs.

Starting with Javascript

 

To enter programming paragraphs within the HTML, you must identify the beginning and end of JavaScript commands, as follows:

<SCRIPT>

Instruction set

</ SCRIPT>

This procedure can be adopted anywhere on the page. However, for better viewing and ease of maintenance, it is recommended that all logic is written in the beginning of the document, through the creation of functions to be invoked when necessary (usually linked to events).

If the logic is written from a particular event, it is not necessary to use the SCRIPT commands.

JavaScript commands are sensitive to the font (capital letter and lower case) in its syntax.

In Javascript, the mathematical operators are widely used:

  • (+) value addition and string concatenation;
  • (-) minus values;
  • (*) multiplication values;
  • (/) values ​​of division;
  • (%) gets the remainder of a division.

Some special controls are also part of languages, they are:

  • b – backspace;
  • f – form feed;
  • n – new line caracters;
  • r – carriage return;
  • t – tab characters;
  • // – comment line;
  • /*….*/ – delimiters to enter text with more than one line as a comment.

Finally, natural delimiters for a string are ‘or’. If necessary the use of these characters as part of the string, it uses the character preceding ‘or’.

Ex: alert (“Beware of using ‘or ‘ in a string”)

You might also like…

Scriptcase & Web Services

This time I will explain how to work with web services inside the Scriptcase, directly with PHP and...

More updates in 9.4 version

Recently version 9.4 was released bringing a new design concept to the generated applications of Sc...

Taking a look at version 9.4

Scriptcase released its version 9.4, and this one brings many interesting news, specially regarding...

Comment this post

Get new posts, resources, offers and more each week.

We will use the information you provide to update you about our Newsletter and Special Offers. You can unsubscribe any time you want by clinck in a link in the footer of any email you receive from us, or by contacting us at sales@scriptcase.net. Learn more about our Privacy Police.