title: uncaught referenceerror mostrar is not defined at HTMLInputElement.onchange
body: <p>I have this HTML which, as you can see, has two calls to javascript functions, it works perfectly in local but when I put it on the server I get the error on the picture. 
  This is the first time that I put anything on a server and I'm really confused so I'll be really thankful for any help.</p>
  
  <pre><code>&lt;html&gt;
      &lt;head&gt;
          &lt;title&gt;Creación de cajas&lt;/title&gt;
          &lt;script    
              type="text/javascript" src="codJavaScript.js"&gt;
          &lt;/script&gt;
          &lt;link href="../estilo.css" rel="stylesheet" type="text/css"&gt;
          &lt;meta charset="UTF-8"&gt;
          &lt;meta name="viewport" content="width=device-width, initial-scale=1.0"&gt;
      &lt;/head&gt;
      &lt;body&gt;
           &lt;div class="menu"&gt; 
              &lt;ul&gt;
                  &lt;li&gt;&lt;a href="menu.php"&gt;Inicio&lt;/a&gt;&lt;/li&gt;
              &lt;/ul&gt; 
          &lt;/div&gt;
           &lt;form action="../Controladores/recogeDatos.php" method="post"&gt;
               &lt;table&gt;
                   &lt;tr&gt;
                       &lt;td&gt;
                           &lt;p&gt;Codigo: &lt;/p&gt;
                       &lt;/td&gt;
                       &lt;td&gt;
                           &lt;input type="text" name="codigo"&gt;
                       &lt;/td&gt;
                       &lt;td&gt;
                           &lt;p&gt;Anchura: &lt;/p&gt;
                       &lt;/td&gt;
                       &lt;td&gt;
                           &lt;input type="text" name="anchura"&gt;
                       &lt;/td&gt;
                   &lt;/tr&gt;
                   &lt;tr&gt;
                       &lt;td&gt;
                           &lt;p&gt;Altura: &lt;/p&gt;
                       &lt;/td&gt;
                       &lt;td&gt;
                           &lt;input type="text" name="altura"&gt;
                       &lt;/td&gt;
                       &lt;td&gt;
                           &lt;p&gt;Profundidad: &lt;/p&gt;
                       &lt;/td&gt;
                       &lt;td&gt;
                           &lt;input type="text" name="profundidad"&gt;
                       &lt;/td&gt;
                   &lt;/tr&gt;
                   &lt;tr&gt;
                       &lt;td&gt;
                           &lt;p&gt;Color: &lt;/p&gt;
                       &lt;/td&gt;
                       &lt;td&gt;
                           &lt;input type="color" name="color"&gt;
                       &lt;/td&gt;
                       &lt;td&gt;
                           &lt;p&gt;Tipo caja: &lt;/p&gt;
                       &lt;/td&gt;
                       &lt;td&gt;
                           &lt;input type="text" name="tipoC" list="tipos" onchange="mostrar(this.value)"&gt;
                           &lt;datalist id="tipos"&gt;
                              &lt;option&gt;Negra&lt;/option&gt;
                              &lt;option&gt;Fuerte&lt;/option&gt;
                              &lt;option&gt;Sorpresa&lt;/option&gt;
                           &lt;/datalist&gt;
                       &lt;/td&gt;
                   &lt;/tr&gt;
                   &lt;tr id="mec"&gt;
                      &lt;td&gt;
                          &lt;p&gt;Mecanismo: &lt;/p&gt;
                      &lt;/td&gt;
                      &lt;td&gt;
                          &lt;input type="text" name="mecanismo"&gt;
                      &lt;/td&gt;
                   &lt;/tr&gt;
                   &lt;tr id="pb"&gt;
                       &lt;td&gt;
                          &lt;p&gt;Placa base: &lt;/p&gt;
                       &lt;/td&gt;
                       &lt;td&gt;
                          &lt;input type="text" name="placa"&gt;
                       &lt;/td&gt;
                   &lt;/tr&gt;
                   &lt;tr id="cont"&gt;
                       &lt;td&gt;
                          &lt;p&gt;Contenido:&lt;/p&gt;
                       &lt;/td&gt;
                       &lt;td&gt;
                          &lt;input type="text" name="contenido"&gt;
                       &lt;/td&gt;
                  &lt;/tr&gt;
                  &lt;tr&gt;
                      &lt;td&gt;
                          &lt;p&gt;Estanter&amp;iacute;a:&lt;/p&gt;
                      &lt;/td&gt;
                      &lt;td&gt;
                          &lt;select name="codEstant" onchange="muestraLejas(this.value)"&gt;
                          &lt;option value="null" selected="selected"&gt;Elige Estanter&amp;iacute;a&lt;/option&gt;
                                                          &lt;option value=C8&gt;C8&lt;/option&gt;
                                                          &lt;/select&gt;
                      &lt;/td&gt;
                      &lt;td&gt;
                           &lt;p&gt;Leja: &lt;/p&gt;
                      &lt;/td&gt;
                      &lt;td&gt;
                          &lt;select id="leja" name="leja"&gt;
                              &lt;option value="null" selected="selected"&gt;Elige Leja&lt;/option&gt;
                          &lt;/select&gt;
                      &lt;/td&gt;
                  &lt;/tr&gt;
                  &lt;tr&gt;
                      &lt;td&gt;&lt;/td&gt;
                      &lt;td&gt;&lt;/td&gt;
                      &lt;td&gt;&lt;/td&gt;
                      &lt;td&gt;
                          &lt;input type="submit" name="creaCaja"&gt;
                      &lt;/td&gt;
                  &lt;/tr&gt;
  
               &lt;/table&gt;
          &lt;/form&gt;
      &lt;/body&gt;
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/l44wx.png" rel="nofollow noreferrer">enter image description here</a></p>
  
  <p>Here is the JavaScript:</p>
  
  <pre><code>function muestraLejas(str){
      var xmlhttp;   
  if (str=="")  {
      document.getElementById("leja").innerHTML="";
      return;
    }
    if (window.XMLHttpRequest)  {// code for IE7+, Firefox, Chrome, Opera, Safari
      xmlhttp=new XMLHttpRequest();
      /* Creamos el objeto request para conexiones http,
      compatible con los navegadores descritos*/
    }
    else  {// code for IE6, IE5
    xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
      /*Como el explorer va por su cuenta, el objeto es un ActiveX */
    }
    xmlhttp.onreadystatechange=function()  {
  
        if (xmlhttp.readyState==4 &amp;&amp; xmlhttp.status==200) {
      document.getElementById("leja").innerHTML=xmlhttp.responseText;
     /*Seleccionamos el elemento que recibirá el flujo de datos*/
      }
    }
  //      alert(str);
      xmlhttp.open("GET","../DAO/getLejas.php?codEstant="+str,true);
      /*Mandamos al PHP encargado de traer los datos, el valor de referencia */
  //        alert(str);
      xmlhttp.send();
    }
  
    function mostrar(str){
        if(str==="Negra"){
            var vis=document.getElementById("pb").style.display='inline';
            var vis=document.getElementById("mec").style.display='none';
            var vis=document.getElementById("cont").style.display='none';
        }
        else if(str==="Fuerte"){
            var vis=document.getElementById("mec").style.display='inline';
            var vis=document.getElementById("pb").style.display='none';
            var vis=document.getElementById("cont").style.display='none';
        }
        else if(str==="Sorpresa"){
            var vis=document.getElementById("cont").style.display='inline';
            var vis=document.getElementById("mec").style.display='none';
            var vis=document.getElementById("pb").style.display='none';
        }
    }
  </code></pre>