JavaScript
Javascript Is THE Scripting Language Of The Web.
Javascript Is Used In Millions Of Web
Pages To Add Functionality, Validate Forms, Detect Browsers, And Much More.
PROGRAM-1 Write
Text With Javascript
<html>
<body>
<script
type="text/javascript">
document.write("Hello
World!");
</script>
</body>
</html>
PROGRAM-2
Write HTML tags with
JavaScript
<html>
<body>
<script type="text/javascript">
document.write("<h1>Hello World!</h1>");
</script>
</body>
</html>
PROGRAM-3
JavaScript in the
body section
<html>
<head>
</head>
<body>
<script type="text/javascript">
document.write("This message is written by JavaScript");
</script>
</body>
</html>
PROGRAM-4
JavaScript in the
head section
<html>
<head>
<script type="text/javascript">
function message()
{
alert("This alert box was called with the onload event");
}
</script>
</head>
<body onload="message()">
<p>We usually use the head section for functions
(to be sure that the functions are loaded before they are called).</p>
</body>
PROGRAM-5
JavaScript in the
head section
<html>
<head>
<script type="text/javascript">
function message()
{
document.write("MY NAME IS CHOKSI AHMAD");
}
</script>
</head>
<body>
<input type="button" value="click here" onclick="message()">
<p>We usually use the head section for functions (to be sure that the functions are loaded before they are called).</p>
</body>
</html>
PROGRAM-6
JavaScript
statements.
<html>
<body>
<script type="text/javascript">
document.write("<h1>This is a heading</h1>");
document.write("<p>This is a paragraph.</p>");
document.write("<p>This is another paragraph.</p>");
</script>
</body>
</html>
PROGRAM-7
Single line
comments.
<html>
<body>
<script type="text/javascript">
// Write a heading
document.write("<h1>This is a heading</h1>");
// Write two paragraphs:
document.write("<p>This is a paragraph.</p>");
document.write("<p>This is another paragraph.</p>");
</script>
</body>
</html>
PROGRAM-8
Multiple lines
comments.
<html>
<body>
<script type="text/javascript">
/*
The code below will write
one heading and two paragraphs
*/
document.write("<h1>This is a heading</h1>");
document.write("<p>This is a paragraph.</p>");
document.write("<p>This is another paragraph.</p>");
</script>
</body>
</html>
javascript practicle tutorial
best tutorial ever
ReplyDelete