Browser does not support form.all method

more than ten years ago, the system only supported ie, and the form.all ("itemname") method was widely used in the form processing. As a result, it is impossible to run
on mainstream browsers other than IE. Is there any other way to directly rewrite the form.all method besides changing it to form ["itemname"] one by one? For example, introduce a common js file and override the form.all method in the js file?
Thank you!

Jun.12,2022

DEMO , you can look at it in chrome and ie, and it looks like you're done looking up all the tags. form.all = = form.getElementsByTagName ('*') . But you pass in itemname as a method. After testing, it is found that both id and name can be found and changed to

.
if(form.all === undefined){
    form.all = function(name){
        return form[name]
    }
}

< hr >

Update-17:46:15 on February 12, 2019
you can see that form.__proto__ is HTMLFormElement , and you can modify this HTMLFormElement.prototype directly. HTMLFormElement.prototype===form.__proto__ got it. You can read

in the demo above.

clipboard.png

clipboard.png

clipboard.png

< hr >
var _form = document.createElement('form')
if(!_form.__proto__.all){
  _form.__proto__.all = function(name){
      return this[name]
  }
}
Menu