Jump to content

borderColor


roeyhaim

Recommended Posts

Hello.

can anyone tell me why this code don't work?

eveything work except for the  "document.getElementById("name").style.borderColor = 'red';"

<script type="text/javascript">
        window.onload = function() {
            document.getElementById("submit").disabled = true;
            document.getElementById("name").onchange = checkIt;
            document.getElementById("chip_num").onchange = checkIt;
        }
        function checkIt() {
            if (document.all||document.getElementById) {
            var Aname;
            var Achip;
            Aname = document.getElementById("name").value.length;
            Achip = document.getElementById("chip_num").value.length;
            if (Aname<1 && (Achip<14 && Achip>1)) {
                document.getElementById("submit").disabled = true;
                document.getElementById("name").style.borderColor = 'red';
            } else {
                document.getElementById("submit").disabled = false;
            }
            }
        }
    </script>
......
<form action="animals.php?action=insert" method="post" name="add">
<table width="50%">
<tr>
    <td align="center">name:</td>
    <td><input type="text" maxlength="25" name="name" id="name"></td>
</tr>
.........

Link to comment
https://forums.phpfreaks.com/topic/221206-bordercolor/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.