To Change Div Content: Through innerHTML we can change any div content by its tag id of the element.
Example:
<html>
<head>
<script>
function f1(str)
{
document.getElementById('d1').innerHTML=str+'<p>content....</p>';
document.getElementById('d1').style.color="green";
document.getElementById('d1').style.backgroundColor='pink';
document.getElementById('d1').style.border="double";
document.getElementById('d1').style.borderColor="blue";
}
</script>
</head>
<body>
<form>
<select name="cars" id="c" onChange="f1(this.value);">
<option value="">Select the Car</option>
<option value="Santro "> Santro </option>
<option value="Wagon-R"> Wagon-R</option>
<option value="Getz">Getz</option>
</select>
</form>
<div id="d1">Not Selected!</div>
</body>
</html>
Example:
<html>
<head>
<script>
function f1(str)
{
document.getElementById('d1').innerHTML=str+'<p>content....</p>';
document.getElementById('d1').style.color="green";
document.getElementById('d1').style.backgroundColor='pink';
document.getElementById('d1').style.border="double";
document.getElementById('d1').style.borderColor="blue";
}
</script>
</head>
<body>
<form>
<select name="cars" id="c" onChange="f1(this.value);">
<option value="">Select the Car</option>
<option value="Santro "> Santro </option>
<option value="Wagon-R"> Wagon-R</option>
<option value="Getz">Getz</option>
</select>
</form>
<div id="d1">Not Selected!</div>
</body>
</html>
Not Selected!
No comments:
Post a Comment