sb********@aol.com wrote:
Hi,
My God, how on earth do you use javacript to change the text color of
an input element, and have it work with IE???
I'm not sure your god is reading this newsgroup, but let's try to answer
anyway :) You normally do it the the same way as with other browsers:
grab a reference to the INPUT element and update its color style
property. Also, note that style cascading rules would apply, so you
could lose the color initially set by CSS selectors.
whatever.style.color = 'black';
Using 'black' as a color to test whether the color is changed isn't very
appropriate since the default font color is normally black...
whatever.style.cssText = 'color:black;';
cssText is a property defined in the W3C DOM Styles specification. IE
does not support this specification but rather uses its own set of
objects and properties (in you want to know more about this, try
searching comp.lang.javascript archives for cssRules, currentStyle and
getComputedStyle).
Internet Explorer does have issues with dynamically created FORM
elements using DOM methods (e.g the NAME attribute not being set
correctly with radio buttons), however I wouldn't be able to tell what
goes wrong without some (trimmed) example code demonstrating the issue.
Try for yourself, in some blank document:
---
<body>
<script type="text/javascript">
var input=document.createElement("input");
input.type="text";
input.style.backgroundColor="yellow";
input.style.color="red";
document.body.appendChild(input);
</script>
</body>
---
HTH.