Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
106
rated 0 times [  110] [ 4]  / answers: 1 / hits: 95346  / 12 Years ago, tue, january 29, 2013, 12:00:00

i am a beginer to javascript.I want to show a hidden textbox on a button click.i do the bellow code, but it doesnt work.



What is the problem with my code?



<!DOCTYPE html>
<html>
<head>
<script type=text/javascript>
function display() {
var z = prompt(enter your name...);
if(z != null) {
document.getElementById(demo).innerHTML = thankyou + z + ..;
document.getElementById(case).style.visibility = 'visible';
} else {
document.getElementById(demo).innerHTML = thankyou;
}
}
</script>
<title></title>
</head>
<body>
<p id=demo>
click on the button.....
</p><button type=button onclick=display()>submit</button>
<form>
<input type=text id=case name=myText style=display:none>
</form>
</body>
</html>

More From » javascript

 Answers
3

replace



document.getElementById(case).style.visibility='visible';


with



document.getElementById(case).style.display='block';

[#80560] Monday, January 28, 2013, 12 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
mariselas

Total Points: 711
Total Questions: 117
Total Answers: 110

Location: Burkina Faso
Member since Thu, Dec 23, 2021
2 Years ago
;