I tried several things. i get invalid char or no object. can one change fore color or setup a mask. the text box contains numbers and if the number is negitive i need it to show in red, black if not.
var oRed = '#ff0000'
var oBlack = '#000000'
if (parseInt(document.getElementById('nm1TextBox').value) < parseInt(0))
{document.getElementById('nm1TextBox').forecolor = oRed;}
else
{document.getElementById('nm1TextBox').forecolor = oBlack;}

Recommended Answers

All 2 Replies

You need to access and modify the style collection. document.getElementById("nm1Textbox").style.color = "red";

thanks. i ended up changing the bgcolor. will try this in the next version.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.