prikladam cely kod:
html:
<head>
  <meta charset="UTF-8">
  <title>Zkouska</title>	
  <script type="text/javascript" src="js/js.js"></script>
</head>
<body onload="document.getElementById('pole').focus();">
  <div id="zadani">
    <form onSubmit="main(this);">
      <input type="text" id="pole" name="pole" onchange="cisla(this.value)"/>
    </form>
  </div>
  <div id="cisla"></div>
</body>
</html>js:function main(form)
{	
  text=form.pole.value;
  var znak=text.charAt(0);
  if(znak=='a'){
    cisla();
  }
  else{
    if(znak=='b'){alert('b');}
    else{
      if(znak=='c'){alert('c');}
      else{alert('nic');}
    }
  }
}
function cisla(text){
  var cislo1=text.charAt(1); var cislo2=text.charAt(2); var cislo3=text.charAt(3);
  cislo=cislo1+cislo2+cislo3; 
  document.getElementById('cisla').innerHTML=cislo;
}tohle je cely kod. moc vam dekuji za vase rady.