Syntax
- <script language = "javascript" type = "text/javascript">
- //Code
- </script>
1) Program
- <html>
- <body>
- <script language = "javascript" type = "text/javascript">
- document.write("Hello World")
- </script>
- </body>
- </html>
OutPut
Hello World
How To Declare Variables.
Must be declared Variables the var keyword.
Syntax
- <head>
- <script type="text/javascript">
- var <var_name>;
- </script>
- </head>
2) Program
- <html>
- <head>
- <script type="text/javascript">
- var myvar="Hello Infodpsoft";
- document.write(myvar);
- </script>
- </head>
- <body>
- </body>
- </html>
OutPut
Hello Infodpsoft
Simple Addition Program.
3) Program
- <html>
- <head>
- <script type="text/javascript">
- var a=10;
- var b=15;
- var c =a+b;
- document.write(c);
- </script>
- </head>
- <body>
- </body>
- </html>
OutPut
25
It's really very helpful..
ReplyDelete