?
Solved

Javascript highlight in red a textbox or textarea

Posted on 2003-03-13
1
Medium Priority
?
1,095 Views
Last Modified: 2008-02-01
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
Comment
Question by:mammouth
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 14

Accepted Solution

by:
avner earned 200 total points
ID: 8127854
To change Border Color use :
document.frm.TxtMsg.style.borderColor='red'

0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question