Why does not it change the border of the input

1

The input confirmarsenha_cadastro should be with the red border but this is not happening, why?

    </script>
    $(function() 
    {
        var dialog, form,
        dialog = $( "#painel_logar_registrar" ).dialog
        ({
          autoOpen: false,
          height: 400,
          width: 480,
          modal: true,
        });

        $( "#login_cadastro_index" ).button().on( "click", function()
        {
          dialog.dialog( "open" );
        });
    });

    function testarcampos()
    {
        if(form_cadastro.senha_cadastro.value != form_cadastro.confirmarsenha_cadastro.value)
        {
            form_cadastro.confirmarsenha_cadastro.style.borderColor = "#FF0000";
        }
    }

</script>

  <div id="painel_logar_registrar">
        <form method="post" action="fazer_cadastro.php" id="form_cadastro" name="form_cadastro" enctype="multipart/form-data">
      <table width="155" border="0" align="right" id="tabela_cadastro">
        <tr>
            <td width="149" align="center" bgcolor="#FFFFFF" class="csslogin">REGISTRAR</td>
          </tr>
          <tr>
            <td height="22" class="fontes_login_cadastro" align="left" valign="bottom">LOGIN</td>
          </tr>
          <tr>
            <td id="design_geral_escrita" height="22" align="left">
            <label for="login_cadastro"></label>
            <input width="200" type="text" name="login_cadastro" id="login_cadastro" />
          </tr>
          <tr>
            <td height="22" class="fontes_login_cadastro" align="left" valign="bottom">EMAIL</td>
          </tr>
          <tr>
            <td id="design_geral_escrita" height="22" align="left">
            <label for="email_cadastro"></label>
            <input width="200" type="text" name="email_cadastro" id="email_cadastro" /></td>
          </tr>
          <tr>
            <td height="22" class="fontes_login_cadastro" align="left" valign="bottom">SENHA</td>
          </tr>
          <tr>
            <td id="design_geral_escrita" height="22" align="left">
            <label for="senha_cadastro"></label>
            <input width="200" type="password" name="senha_cadastro" id="senha_cadastro" /></td>
          </tr>
          <tr>
            <td height="22" class="fontes_login_cadastro" align="left" valign="bottom">CONFIRMAR SENHA</td>
          </tr>
          <tr>
            <td id="design_geral_escrita" height="22" align="left">
            <label for="confirmarsenha_cadastro"></label>
            <input width="200" type="password" onBlur="testarcampos(this.value)" name="confirmarsenha_cadastro" id="confirmarsenha_cadastro" /></td>
          </tr>
          <tr>
            <td id="design_geral_escrita2" height="22" align="center">
            <input type="submit" name="cadastrar" id="button_cadastrar" value="CADASTRAR" /></td>
          </tr>
            </table> 
        </form>
    </div>

    <div id="painel_fazer_upload">
        <form action="fazer_upload.php" enctype="multipart/form-data" method="post">
            <input name="arquivo" id="arquivo" type="file">
            <input id="qualquer" type="submit">
        </form>
    </div> 
    
asked by anonymous 21.05.2015 / 21:48

1 answer

2

I think this element does not have the property border , it only passes the color with borderColor , that is, it does not find a border to apply this color.

Then you create the border by passing its size, style and color with style.border

Try this:

function testarcampos()
    {
        if(form_cadastro.senha_cadastro.value != form_cadastro.confirmarsenha_cadastro.value)
        {
            form_cadastro.confirmarsenha_cadastro.style.border = "1px solid #FF0000";
        }
    }
    
21.05.2015 / 21:54