Thursday, July 31, 2008

How To Clear All The Controls In Form

function clrCtrls()
{
with(document.forms[0])
{
for(var i=0; i < elements.length; i++)
{
var e = elements[i];
if(e.type == "checkbox" e.type == "radio" ){e.checked = false;}
if(e.type == "text" e.type == "hidden"){e.value = "";}
if(e.type == "select-one"){e.selectedIndex = 0;}
}
}
return false;
}

Call This Fuction From any Event = "return clrCtrls()";
IE/Firefox Supproted


No comments:

Creative Commons License
Disclaimers:We have tried hard to provide accurate information, as a user, you agree that you bear sole responsibility for your own decisions to use any programs, documents, source code, tips, articles or any other information provided on this Blog.