Change font color (IEonly)

[Total: 0    Average: 0/5]

This shows how to use the style properties to change the font color.

Body Code:

This example shows how to have IE change the style properties of the object.
With IE, any object can contains the style object.

With NS, the document object inside the object must be re-written to change things like this.
<BR>
<BR>
<script>
var isIE = document.all?true:false;
function colorIt() {
  if (isIE) {
    document.all.d0.style.color="gold";
  }
}
function borderIt() {
  if (isIE) {
    document.all.d0.style.borderColor="red";
    document.all.d0.style.backgroundColor="pink";
  }
}
var _color   = "blue";
var _bcolor  = "blue";
var _bgcolor = "#A0A0A0";
function writeIt() {
  var _string  = '';
      _string += '<div id=d>';
      _string += '<div id=d0 style="background-Color:'+_bgcolor+';color:'+_color+';border-Width:5;border-Style:solid;border-Color:'+_bcolor+';width:300;height:300;clip:rect(0,300,300,0)">';
      _string += 'THIS IS SOME TEXT<BR>';
      _string += '<a href="javascript:colorIt()">Change font color to gold</a><BR>';
      _string += '<a href="javascript:borderIt()">Change text to be surround by a border with background color pink</a><BR>';
      _string += '</div>';
      _string += '</div>';
  document.write(_string);
}
writeIt();
</script>

Times Viewed: 0

Leave a Reply

Your email address will not be published. Required fields are marked *