[thelist] Disable Multiple Forms with JavaScript
Peter Brunone (EasyListBox.com)
peter at easylistbox.com
Fri Jul 23 21:24:25 CDT 2004
Hi Mike,
Something like this should work (watch for wrapping):
var currentForm;
for(var iForm=0;iForm<document.forms.length;iForm++) {
currentForm = document.forms[iForm];
/* I assume this is how you disable a form,
if such a thing can be done. */
currentForm.disabled = true;
// The next line will probably wrap
for(var
iElement=0;iElement<currentForm.elements.length;iElement++) {
currentForm.elements[iElement].disabled = true;
}
}
Note that this may not affect input elements of type image; you
may have to do that some other way. Also note that "disabled" is hardly
a ubiquitous attribute in older browsers; you may have to add some extra
Javascript like
currentElement.onFocus = "window.focus";
The idea here is to set the focus somewhere else so the user can
never stay on an element long enough to do anything. Anyhoo, this
should get you started; if you have more questions, fire away.
Cheers,
Peter Brunone
---------------------------------
Do the impossible. Go home early.
www.EasyListBox.com
---------------------------------
-----Original Message-----
From: thelist-bounces at lists.evolt.org On Behalf Of Mike Carlson
Anyone have any code that will disable all forms and all form elements
of said forms?
I have a page that has a few forms on it and I need to disable
everything on the page so the user cannot make any changes.
Thanks,
--Mike
More information about the thelist
mailing list