admin.js 1.2 KB

12345678910111213141516171819202122232425262728293031323334
  1. (function() {
  2. document.getElementById('uploadbtn').onchange = function () {
  3. document.getElementById('uploadfile').value = this.value.replace(/^.*\\/, "");
  4. var len = document.getElementById('uploadfile').value.length - 7;
  5. document.getElementById('uploadfile').setAttribute('size', len);
  6. var len = document.getElementById('uploadfile').offsetWidth;
  7. document.getElementById('uploadbtn').style.width = len + "px";
  8. };
  9. })();
  10. function formChange() {
  11. if (document.activeElement.tagName.toLowerCase() != 'select') {
  12. console.log('not select');
  13. return false;
  14. }
  15. aElem = document.activeElement;
  16. aParent = aElem.parentElement;
  17. sOpt = aElem[aElem.selectedIndex];
  18. console.log(aElem.id + sOpt.id);
  19. if (aElem.id + sOpt.id == 'wanprotostat') {
  20. document.getElementById('wanaddr').setAttribute('class','show');
  21. }
  22. if (aElem.id + sOpt.id == 'wanprotodhcp') {
  23. document.getElementById('wanaddr').setAttribute('class','hide');
  24. }
  25. if (aElem.id + sOpt.id == 'wanifnamewlan') {
  26. document.getElementById('wanwifi').setAttribute('class','show');
  27. }
  28. if (aElem.id + sOpt.id == 'wanifnameeth') {
  29. document.getElementById('wanwifi').setAttribute('class','hide');
  30. }
  31. };