In Association with Amazon.in   Flipkart

Tuesday, November 19, 2013

JavaScript To Hide or Unhide any Object in Web Page Example

JavaScript To Hide or Unhide any Object in Web Page:

Example:

<script>
function check(n)
{
if(n==0)
{
document.getElementById('hbtn').style.display="none";
document.getElementById('sbtn').style.display="block";
document.getElementById('siframe').style.display="none";
}
else
{
document.getElementById('hbtn').style.display="block";
document.getElementById('sbtn').style.display="none";
document.getElementById('siframe').style.display="block";
}
}
</script>
<body>
<input type="button" value="Hide Iframe" id="hbtn" onClick="check(0)" />
<input type="button" value="Show Iframe" id="sbtn" style="display:none" onClick="check(1)" />
<hr/>
<iframe src="http://www.in.com" width="400" height="300" id="siframe" ></iframe>
<p>Welcome To www.itjobcareers.blogspot.com site.</p>
</body>

Output:



No comments:

Post a Comment


Related Posts Plugin for WordPress, Blogger...