Gernot Back: Problem mit Rahmenfarbe von Div ändern

Beitrag lesen

Hallo Enrico,

ich glaube ja, da du die umgebenden Divs umrahmen willst und nicht die Inputfelder, um deren Fokus es geht, führt doch kein Weg um JS vorbei, nicht nur beim IE

Gruß Gernot

Meine Lösung wie folgt:

<html>
<head>
<title>FocusRahmen</title>
<style type="text/css">
<!--
.rahmen {
  border:solid 1px #000;
  width:400px;
  height:100px;
  text-align:center;
  margin:10px;
}

input {
  position:relative;
  top:40px;;
  width:200px;
  height:20px;
}

-->
</style>
<script language="JavaScript">
<!--
function focblur (x) {
  if(x.parentNode.style.borderColor=="#f00") {
    x.parentNode.style.borderColor="#000";
  } else {
    x.parentNode.style.borderColor="#f00";
  }
}
//-->
</script>
<noscript></noscript>
</head>
<body text="#000000" bgcolor="#FFFFFF" link="#FF0000" alink="#FF0000" vlink="#FF0000">
<form action="" method="" target="">
  <div class="rahmen"><input onFocus="focblur(this)" onBlur="focblur(this)" type="Text" name="" value="" size="" maxlength=""></div>
  <div class="rahmen"><input onFocus="focblur(this)" onBlur="focblur(this)" type="Text" name="" value="" size="" maxlength=""></div>
</form>
</body>
</html>