[thelist] Disable Multiple Forms with JavaScript
Mike Carlson
mike at mcarlson.net
Tue Aug 3 12:25:04 CDT 2004
Peter:
Thanks for the code. I am running into a problem though. It works perfectly in FireFox .9 but not in IE 6. I get some JS error about Object Expected in IE.
Any ideas? I fixed the wrap but otherwise the code is exactly the same. Like I said it works in Mozilla just fine. I have no image input type, just text boxes and buttons.
Thanks,
--Mike
From: Peter Brunone (EasyListBox.com)
Sent: Fri 7/23/2004 9:24 PM
To: thelist at lists.evolt.org
Subject: RE: [thelist] Disable Multiple Forms with JavaScript
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
--
* * Please support the community that supports you. * *
http://evolt.org/help_support_evolt/
For unsubscribe and other options, including the Tip Harvester
and archives of thelist go to: http://lists.evolt.org
Workers of the Web, evolt !
More information about the thelist
mailing list