roeyhaim Posted December 10, 2010 Share Posted December 10, 2010 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 More sharing options...
ohdang888 Posted December 10, 2010 Share Posted December 10, 2010 Note: Always declare the border-style property before the border-color property. An element must have borders before you can change the color. from http://www.w3schools.com/css/pr_border-color.asp Link to comment https://forums.phpfreaks.com/topic/221206-bordercolor/#findComment-1145335 Share on other sites More sharing options...
roeyhaim Posted December 10, 2010 Author Share Posted December 10, 2010 still dont work..... Link to comment https://forums.phpfreaks.com/topic/221206-bordercolor/#findComment-1145386 Share on other sites More sharing options...
Adam Posted December 10, 2010 Share Posted December 10, 2010 Does the submit button get set to disabled=false? Link to comment https://forums.phpfreaks.com/topic/221206-bordercolor/#findComment-1145395 Share on other sites More sharing options...
roeyhaim Posted December 11, 2010 Author Share Posted December 11, 2010 yes.... all the code is OK except for this line... Link to comment https://forums.phpfreaks.com/topic/221206-bordercolor/#findComment-1145627 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.