![]() |
| ||
| how do i change fore color in a textbox with javascript 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;} |
| ||
| Re: how do i change fore color in a textbox with javascript You need to access and modify the style collection. document.getElementById("nm1Textbox").style.color = "red"; |
| ||
| Re: how do i change fore color in a textbox with javascript thanks. i ended up changing the bgcolor. will try this in the next version. |
| All times are GMT -4. The time now is 10:15 pm. |
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC