Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1106
  • Last Modified:

Javascript highlight in red a textbox or textarea

I have a textarea like this: <textarea name="TxtMsg" rows="10" cols="60" wrap="virtual"></textarea>

On the form, i have a onSubmit who call a function like this:
<form name="frm" method="post" action="page.asp" onSubmit="return(VerifAllField());")>

The function VerifAllField will check if a field is empty, if the field is empty, i want to border the field in red.

Here is the function

function VerifAllField()
{
     if (document.frm.TxtMsg.value=='')
     {
          document.frm.TxtMsg.style.border='solid 2pt;';
          document.frm.TxtMsg.style.border-color='red;';
          return (false);
     }
}


This is working good (document.frm.TxtMsg.style.border='solid 2pt;';)
This is not working  (document.frm.TxtMsg.style.border-color='red;';)

How can i change the border color?

Thankx
0
mammouth
Asked:
mammouth
1 Solution
 
avnerCommented:
To change Border Color use :
document.frm.TxtMsg.style.borderColor='red'

0

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Tackle projects and never again get stuck behind a technical roadblock.
Join Now