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;}
sqlchopper
0
Newbie Poster
Recommended Answers
Jump to PostYou need to access and modify the style collection.
document.getElementById("nm1Textbox").style.color = "red";
All 2 Replies
Reply to this topic
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.