Screen output and keyboard input:
Methods to show output
[Link] or [Link]
[Link]
[Link]
[Link]
Example 1:
<html>
<head>
<title>write and writeln</title>
</head>
<body>
<ul>
<li>HTML
<li>CSS
<li>Jvascript
</ul>
<input type="button" value="click"
onclick="[Link]('i will delete you')">
<script>
[Link]('hello');
[Link](4+6);
</script>
</body>
</html>
[Link]() method:
Example:
<html>
<head>
<title>write and writeln</title>
</head>
<body>
<ul>
<li>HTML
<li>CSS
<li>Jvascript
</ul>
<script>
[Link]("<pre>hello");
[Link]("4+6" + "= " +(4+6));
[Link]("</pre>");
</script>
</body>
</html>
[Link]() Method:
Description
The alert() method displays an alert box with a message and an OK button.
The alert() method is used when you want information to come through to the
user.
Example:
<!DOCTYPE html>
<html>
<body>
<h1>The Window Object</h1>
<h2>The alert() Method</h2>
<p>Click the button to display an alert box.</p>
<button onclick="myFunction()">Try it</button>
<script>
function myFunction() {
alert("Hello! I am an alert box!");
}
</script>
</body>
</html>