Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting
Views: 2847 | Replies: 1
![]() |
Peace, Can you help me with Show And Hide?:
I made an Input text I want to hide it, And I want to show it if I click on a button. How can I do it?
Thanks.
I made an Input text I want to hide it, And I want to show it if I click on a button. How can I do it?
Thanks.
The great scientist see his web-site:
http://www.elnaggarzr.com/en
I'm sure that will be good for you!
http://www.elnaggarzr.com/en
I'm sure that will be good for you!
It can be done in two ways. The difference between the two methods is obvious: one of them(visibility) doesn't change the page layout while the other(display) does.
<html>
<head>
<script>
function hide()
{
var elem = document.getElementById('myP');
elem.style.display = 'none';
}
function show()
{
var elem = document.getElementById('myP');
elem.style.display = '';
}
function hide2()
{
var elem = document.getElementById('myP2');
elem.style.visibility = 'hidden';
}
function show2()
{
var elem = document.getElementById('myP2');
elem.style.visibility = 'visible';
}
</script>
</head>
<body>
<form>
<h2 align="center">Using the display property of CSS</h2>
<p id="myP">Here is some text which I want to hide</p>
<br />
<input type="button" onclick="hide();" value="Hide" />
<input type="button" onclick="show();" value="Show" />
<h2 align="center">Using the visibility property of CSS</h2>
<p id="myP2">Here is some text which I want to hide</p>
<br />
<input type="button" onclick="hide2();" value="Hide" />
<input type="button" onclick="show2();" value="Show" />
</form>
</body>
</html> I don't accept change. I don't deserve to live.
Happiness corrupts people.
Failing to value the lives of others cheapens your own.
Happiness corrupts people.
Failing to value the lives of others cheapens your own.
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)






Linear Mode