Getting Started
JavaScript powers many of sites in world everyday. Even this create dynamic web site. JavaScript also can be used for other applications like you can use this for server side programming and for creating desktop apps.
Before Getting Started
You must know about HTML before you get started . If you don’t know about HTML, then go this website for great tutorials with exercise and the website is http://www.codecademy.com/tracks/web
It’s no need, but some knowledge of CSS will help you create attractive ,dynamic website .
i recommend you to use google chrome or Mozilla for checking of your javascript code..
Basic Syntax
<script type="text/javascript"> //enter your code </script>
INCLUDING JAVASCRIPT IN HTML
Javascript basically use for web browser and now i am showing you how you connect javascript with your html file ; there are two method which help you to connect your javascript with your html file;below i am write first method syntax see it.
//your code
</script>
Second method
In the second method you need to create your javascript file with .js extension and below i write the syntax of second method
<html>
<head>
<script src=”demo.js”>
</script>
</head>
<body>
</body>
</html>
and here demo.js is your javascript file and src attribute use for calling this file and it same as C,C++ file calling #include<stdio.h>
Basic I/O method:
In javascript for i/o we use following methods
Method | DESCRIPTION | EXAMPLES |
---|---|---|
console.log() | for output | console.log(“hello!”); |
prompt() | for input | prompt(“username”); |
confirm() | for dialog box | confirm(“Press a button!”); |
Join the discussion