Guest User

Untitled

a guest
Jul 17th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. function buttonfix() {
  2.  
  3. var buttons = document.getElementsByTagName('button');
  4.  
  5. for (var i=0; i < buttons.length; i++) {
  6.  
  7. if (buttons[i].onclick) { continue; }
  8.  
  9. buttons[i].onclick = function () {
  10. for (j=0; j<this.form.elements.length; j++) {
  11. if (this.form.elements[j].tagName == 'BUTTON') {
  12. this.form.elements[j].disabled = true;
  13. }
  14. }
  15. this.disabled = false;
  16.  
  17. var input = document.createElement('input');
  18. input.setAttribute('name', this.name);
  19. input.setAttribute('value', this.attributes.getNamedItem('value').nodeValue);
  20. input.setAttribute('type', 'hidden');
  21.  
  22. this.form.appendChild(input);
  23. this.name = '';
  24. }
  25. }
  26. }
  27. window.attachEvent("onload", buttonfix);
Add Comment
Please, Sign In to add comment