Set - 5

Question 11 :

How to disable an HTML object ?

Answer :

document.getElementById("myObject").disabled = true;

Question 12 :

To write messages to the screen without using "document.write()" ? 

Answer :

Changing the contents of an element is a much better solution. When the method showStatus is invoked it will change the content of the span.

function showStatus(message) {
	var element = document.getElementById("mystatus");
	element.textContent = message; //for Firefox
	element.innerHTML = message; //for IE (why can't we all just get along?)
	return true;
<span id="mystatus">Test. </span>

Question 13 :

How to Add new elements dynamically ?

Answer :

<html xmlns="" xml:lang="en" lang="en">
<script type="text/javascript">
function addNode() {
	var newP = document.createElement("p");
	var textNode = document.createTextNode(" I'm a new text node");
<body onLoad="addNode();" style=" background: url('../images/Sand-1280.jpg'); background-color: yellow;">
    <p id="firstP">firstP<p>

Question 14 :

How to have an element invoke a javascript on selection, instead of going to a new URL: ?

Answer :

<script type="text/javascript">
	function pseudoHitMe() {
<a href="javascript:pseudoHitMe()">hit me</a>

Question 15 :

How to have the status line update when the mouse goes over a link (The support of the status line is sporadic)? 

Answer :

<a href="javascript.shtml" onmouseover="window.status='Hi There!';return true" onmouseout="window.status='';return true">Look at the Status bar</a>

Look at the Status bar as your cursor goes over the link.