Popular
Electronics & Technology Blog
Vijayendra Singh
-
Java Scripts Tutorial
-
JavaScript is a scripting language widely used for client-side web development.
We can make forms and other simple applications in java scripts to make our website more interactive for the viewers.
This is a Java script tutorial to teach you basics of Java Scripts and how you can use it for your own webpage.
The <script type="text/javascript"> represents start of java script and </script> tells where the JavaScript ended.
It comes under the <body></body> & <head></head>tags of our html page.
For example the script below:
<html>
<body>
<script type="text/javascript">
document.write("<h1>Hello JAVA!</h1>"); Use for writing it to webpage
</script>
</body>
</html>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If you want to use external JavaScript you can accomplish by writhing these statements:-
<head>
<script type="text/javascript" src="javascriptname.js"></script>
</head>for writing comments we use //
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
We can declare JavaScript variables with the var statement.
var t=9; or t=9
var myname="vijay";
we can perform arithmetic operations like x=y+t
If you want to add string then its simple simply do
txt1="My Name is";
txt2="Vijay";
txt3=txt1+" "+txt2;== is equal to
!=is not equal to
e.g
if (salary<10,000) document.write("Employee");
else document.write("Manager");
We have a Prompt Box, Alert Box & Confirm Box given by:
alert("alert");
confirm("Confirm");
prompt("xyz","defaultvalue");
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Using Switch Statement
switch(X)
{
case 1:
block 1
break;
case 2:
block 2
break;
default:
if X is
different from case 1 and 2
}~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Functions used in Java Script e.g
<html>
<head>
<script type="text/javascript">
function show()
{
alert("Clicked");
}
</script>
</head><body>
<form>
<input type="button" value="Click me"
onclick="show()" >
</form>
</body>
</html>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Free Java scripts
JavaScript City
A guide to free JavaScripts, tutorials, and resources on the web.JavaScripts.com
There are a lot of free scripts to use!JavaScript Search
JavaScript Search is your source for hundreds of free JavaScripts and JavaScript related information, including scripts, tutorials, FAQ's, tips.The JavaScript Source
A large collection of cut and paste JavaScripts to use on your pages~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Some Excellent JavaScripts
A script that displays the current date and time.
This script presents a function that calculates the number of days between any two dates. For more Java Scripts please visit this link.
Latest Electronics & Technology News