09 August 2016

Building a website should be familiar with javascript



Before you build a website that is responsive, you should know first about javascript. Then what is javascript?.
JavaScript is a language in the form of a collection of scripts that are running on an HTML document. Throughout the history of the internet is the first scripting language for the web. This language is a programming language to provide additional capabilities against the HTML language by allowing commands executed on the user's side, meaning that the browser side instead of on the server side of the web.
Building a website should be familiar with javascript

JavaScript is a language that is "case sensitive" means to distinguish the variable naming and functions that use uppercase and lowercase letters, examples of variables or functions with different TEST with variable name
with a name of test. And the latter languages such as Java or C, although this is not mandatory, any instruction may be terminated with a semicolon (;).

Writing Javascript Code
There are several ways to write the Javascript code in the
document/ HTML page, i.e. using the tag <script>, use external files, and through specific events.

1. Use the <SCRIPT> tag. example:
< script language = "javascript" >
......
</script>

2. using external files
The next way is to write a Javascript program code in a text file and then a text file that contains the Javascript code in the callback from within a HTML document (specifically Netscape starting with version 3 and above). example:
< script language = "javascript" src = "location/file.js" > </script>

3. Through a particular event
The event is a term from one of the action performed by the user, such as the click of the mouse buttons, further discussion is on other material. example:
< tag eventHandler = "Javascript code that will be inserted" >

Writing comments in Javascript
We can use the same way with the existing rules on language C/C++ or Java.

a. to write comments in a row
We can use the double forward slash characters (//). example:
// all the characters behind the sign of "//" will not be executed

b. to write comments that consist of a few lines
We can use the characters/* and */ . example:
/* All lines between the 2 marks will not be executed by the compiler */

Example program:
<html>
<head>
<title> sample of javascript programs </title>
</head>
<body>
< script language = "javascript" >
alert ("Hello!");
</script>
</body>
</html>

Demo here
Share:

0 komentar:

Post a Comment

Blog Archive