locked
Textbox Border color problem RRS feed

  • Question

  • Hi there, I would like to highlight the textbox's border to red when it is not filled, but to no avail. The codes are as shown below, and I hope you guys can help me solve it. [B][U]Javascript[/U][/B] [CODE]function check(checkForm) { var fields = new Array("First Name","Last Name","Email Address", "Domain Name"); var index = new Array(),k=0; for(var i=0;i<fields.length;i++) { var isFilled = false; var c = document.getElementsByName(fields[i]); for(var j = 0; j < c.length; j++) if(!c[j].value == "") isFilled = true; if(!isFilled) { index[k++] = fields[i]; } } if(k.length!=0) { joinComma = index.join(', '); alert('The field(s) corresponding to '+ joinComma + ' is/are not selected.'); return false; } } [/CODE] [U][B]HTML[/B][/U] [CODE] <label> *First Name:</label> <input type="text" id="Text26" name="First Name"/> <br /> <br /> <label> *Last Name:</label> <input type="text" id="Text27" name="Last Name" /><br /> <br /> <label> *Email Address:</label> <input type="text" id="Text28" name="Email Address" /> @ <select id="Select5" name="Domain Name"> <option></option> <option>hotmail.com</option> <option>yahoo.com</option> </select>[/CODE]
    Wednesday, January 20, 2010 3:45 AM

All replies

  • I guess, same thread has been posted twice check

    http://social.msdn.microsoft.com/Forums/en-US/jscript/thread/d476507e-4c24-477e-8f7f-a3bd21c3d03b

    chandu
    Saturday, January 30, 2010 1:39 PM