Andy: bgcolor mit js in einer tabellenzelle verändern unter ns 4.x

Beitrag lesen

Hallo,

ich habe ein Problem mit folgendem Script unter Netscape 4.7, hier wird die Hintergrundfarbe nicht geändert.

Ich hoffe es kann sich jemand meinem Problem annehmen.

Ciao
Andy

<html>
<head>
<script language="JavaScript"><!--
function checkDate(value,id){
 var IE5_NS6 = (document.getElementById) ? 1 : 0;
 var NS4 = (document.layers) ? 1 : 0;
 var IE4 = (document.all) ? 1 : 0;

if ( value == "" ){
    if (IE5_NS6)
      window.document.getElementById(id).style.backgroundColor = 'yellow';
´   else if (IE4)
      window.document.all[id].style.background = 'yellow';
    else if (NS4)
      window.document.layers[id].document.bgColor = 'yellow';
    return false;
  }

var r = true;
  var pattern = /[A-Za-z]/;
  if ( value.match(pattern) != null )
  r = false;
  pattern=/./;
  var da = value.split(pattern);
  if ( da[0]==null || da[1]==null || da[2]==null )
    r = false;
  var tag = da[0];
  var monat = da[1];
  var jahr = da[2];
  if( tag<0 || tag>31 )
    r=false;
  if( monat<0 || monat>12 )
    r = false;
  if( jahr<1900 || jahr>3000 )
    r = false;
  if( r == false ){
    if (IE5_NS6)
      window.document.getElementById(id).style.backgroundColor = 'red';
    else if (IE4)
      window.document.all[id].style.background = 'red';
    else if (NS4)
      window.document.layers[id].document.bgColor = 'red';
    return false;
  }
  if (IE5_NS6)
    window.document.getElementById(id).style.backgroundColor = 'transparent';
  else if (IE4)
    window.document.all[id].style.background = 'transparent';
  else if (NS4)
    window.document.layers[id].document.bgColor = 'transparent';
  return true;
}

//--></script>

</head>

<body bgcolor="beige">
 <form name="form">
  <table>
   <tr>
    <td>Date:</td>
    <td id='name_Border' bgColor='yellow'>
     <input type="text" name="name" size="20" onChange="checkDate(this.value,'name_Border');" />
    </td>
   </tr>
  </table>
 </form>
</body>
</html>