반응형
Disable All Form Elements
Another question I have seen a lot lately is how can I disable all of the form elements on the page with JavaScript? Well it is rather simple and only takes a few lines of code. All you need to do is loop through the Form elemnt array and set the disabled property to true to disable the elements and false to enable the elements.
function DisableEnableForm(xForm,xHow){
objElems = xForm.elements;
for(i=0;i < objElems.length;i++){
objElems[i].disabled = xHow;
}
}
To execute the function, you just need to send the form object reference and a boolean value to the function. The following code is an example how to call the function disable the elements as the page is loading.
window.onload= function(){
DisableEnableForm(document.Form1,true);
}
Hope this helps!
http://radio.javaranch.com/pascarello/2005/05/17/1116340367337.html
Another question I have seen a lot lately is how can I disable all of the form elements on the page with JavaScript? Well it is rather simple and only takes a few lines of code. All you need to do is loop through the Form elemnt array and set the disabled property to true to disable the elements and false to enable the elements.
function DisableEnableForm(xForm,xHow){
objElems = xForm.elements;
for(i=0;i < objElems.length;i++){
objElems[i].disabled = xHow;
}
}
To execute the function, you just need to send the form object reference and a boolean value to the function. The following code is an example how to call the function disable the elements as the page is loading.
window.onload= function(){
DisableEnableForm(document.Form1,true);
}
Hope this helps!
http://radio.javaranch.com/pascarello/2005/05/17/1116340367337.html
반응형
'Know > JavaScript' 카테고리의 다른 글
window.createPopup() (0) | 2007.02.21 |
---|---|
JScript 고급개체 만들기[PROTOTYPE] (0) | 2006.07.26 |
Disable All Links with JavaScript (0) | 2005.09.23 |