[Racine des codes] [Page précédente]

SetStyleReadOnly

/Html JavaSript/css/SetStyleReadOnly.js
//-----------------------------------------------------------------------------
// Parcours les <form> et leurs <elements>, fixe le style des
// <elements> qui sont en readOnly
//-----------------------------------------------------------------------------
function SetStyleReadOnly() {
  var nF, nE, FF;
  for (nF=0; nF<document.forms.length; nF++) {
    FF = document.forms[nF];
    for (nE=0; nE<FF.elements.length; nE++) {
      if (typeof(FF.elements[nE].readOnly) != "undefined" && FF.elements[nE].readOnly) {
        FF.elements[nE].style.backgroundColor="#CAC8C0";
        //alert(FF.elements[nE].name + " : readOnly");
        //-- En propre (DOM1) marche pas avec IE6
        //if (typeof(FF.elements[nE].attributes["readonly"]) != "undefined")
        //  alert(FF.elements[nE].attributes["readOnly"].specified);
      }
    }
  }
}
[edit]