Learning JavaScript in just 10 Days
Javascript can do a lot of work in the browser window. But we like to know some important basic tasks that can do Java Script for you.
- In a web page or web application JavaScript give the “Life” that is very much important in recent time. Because now user often wants to interact with the webpage while browsing.
- JavaScript can react to any kind of event in the browser window.
- It is used to create a dynamic and interactive web page that gives Rich Experience to users.
- JavaScript can be used to validate data or form data.
- It is used to create cookies where the browser can store the user’s information.
Learning Javascript Syntax:
Writing JavaScript is not difficult. As a Script, its syntax is very simple and easy. First, you should write the script opening tag and as well as put the script closing tag in body tags. Then write your first script within the script tags. I like to show you our first Javascript program. But how can you write this script? Don’t Worry! You can download NotePad++ or you can simply use Notepad or any kind of plain text editor. As an advanced web designer of course you can use Adobe Dreamweaver. Now write the following scripts.
<!DOCTYPE html>
<html>
<head>
<title>First JS Program</title>
</head>
<body>
<script type=”text/javascript”>
document.write(“Hello Javascript”);
</script>
</body>
</html>
After writing the script you should save it in a folder, say your file name will be “firstProgram”. Of course save the file as an HTML file, which means .html or .htm
Now the first thing is we put the script type. But it is not mandatory. If you just write the script tag it will work. The second thing is we write a syntax that starts with a document. write. It is a method to write anything on your HTML page. That means if you want to see any output from your script you can simply put it in the brackets of the document. write(). The final thing is we should put a semicolon after any statement to terminate it. When you write a single statement, it is mandatory. But when you write multiple statements it is a must.
OK, that’s all for today. Hope you will find more interesting topics in my next post on Javascript. If you need help then don’t forget to write a comment. If you find any error then please inform me.