Monday, December 12, 2011

How to add more fields in the html forms when a certain condition is met?

I want to add more fields in the html form I filled in when I checked the check box. How to do it ? Can you some give me some quick help ? ThanksHow to add more fields in the html forms when a certain condition is met?
%26lt;html%26gt;

%26lt;body%26gt;

%26lt;script type=';text/javascript';%26gt;

function toggle(target) {

var extra = document.getElementById(target);



if(extra.style.display == ';none';)

{

extra.style.display = ';block';;

}

else

{

extra.style.display = ';none';;

}



}

%26lt;/script%26gt;

%26lt;form%26gt;

%26lt;input type=';checkbox'; onclick=';toggle('extra')';/%26gt;

%26lt;div style=';display: none'; id=';extra';%26gt;

You have checked the checkbox :-)

%26lt;/div%26gt;

%26lt;/form%26gt;

%26lt;/body%26gt;

%26lt;/html%26gt;

No comments:

Post a Comment