skylab
08-09-2004, 11:03 PM
:rolleyes: Before I begin, I'm trying to take an existing font color value and change it so it displays as another color. I'm using Domino's Search function, so I can't just change the source, since I have no control over it. However, I want to change the color of the highlighted text from "green" to something else. My problem is I can't see the "green" font color items, only everything else. Now the for the code.
I have some HTML where I cannot find certain FONT Colors using the document.all.tags... The code snippit is as follows:
<tr valign="top"><td width="120">
<font size="2" color="#000080"><font color="green"><b>Policy</b></font> Name:</font>
</td><td width="168" bgcolor="#FFFFFF"><font size="2">Emergency Codes</font></td></tr>
When I use this javascript code (minus the periods for formatting):
var test1
var allColor = document.all.tags( "FONT" )
for (var i = 0; i < allColor.length; i++ ) {
.. test2 = allColor[i].attributes
.. for (var j = 0; j < test2.length; j++ ) {
..... if (test2.item(j).nodeName == "color") {
........ test1 = test1 + ";" + test2.item(j).nodeValue
..... }
.. }
}
alert( test1 )
I end up getting a long list of the Font colors in the document I'm searching. With the HTML code segment above I get the font color value "000080" in the prompt but I don't get any of the "green" values in this list. Is there something I'm missing here? I thought 'all' searches through every item, regardless if its embedded in another or not. Help, help, help. I feel I'm so close and yet I've racked my brain over this one.
Any fresh and more brilliant brain out there willing to help? Thanks every so much. :thumbsup:
Tim
I have some HTML where I cannot find certain FONT Colors using the document.all.tags... The code snippit is as follows:
<tr valign="top"><td width="120">
<font size="2" color="#000080"><font color="green"><b>Policy</b></font> Name:</font>
</td><td width="168" bgcolor="#FFFFFF"><font size="2">Emergency Codes</font></td></tr>
When I use this javascript code (minus the periods for formatting):
var test1
var allColor = document.all.tags( "FONT" )
for (var i = 0; i < allColor.length; i++ ) {
.. test2 = allColor[i].attributes
.. for (var j = 0; j < test2.length; j++ ) {
..... if (test2.item(j).nodeName == "color") {
........ test1 = test1 + ";" + test2.item(j).nodeValue
..... }
.. }
}
alert( test1 )
I end up getting a long list of the Font colors in the document I'm searching. With the HTML code segment above I get the font color value "000080" in the prompt but I don't get any of the "green" values in this list. Is there something I'm missing here? I thought 'all' searches through every item, regardless if its embedded in another or not. Help, help, help. I feel I'm so close and yet I've racked my brain over this one.
Any fresh and more brilliant brain out there willing to help? Thanks every so much. :thumbsup:
Tim