SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Thread: selector

  1. #1
    SitePoint Evangelist
    Join Date
    Apr 2005
    Location
    London, UK
    Posts
    506
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    selector

    Guys,

    In this html page there is "=" that I want to change the color to #ffffff.

    The problem is that I dont have direct access to that part of the html whete there's "=" sign. So how can I do this using Java Script.

    Thanks

  2. #2
    SitePoint Wizard Stomme poes's Avatar
    Join Date
    Aug 2007
    Location
    Netherlands
    Posts
    10,276
    Mentioned
    50 Post(s)
    Tagged
    2 Thread(s)
    There is a = sign in page text? Describe a bit more what you have for HTML.

  3. #3
    SitePoint Evangelist
    Join Date
    Apr 2005
    Location
    London, UK
    Posts
    506
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    there dynamic html which is pulled in the html page that I canot modify, but once the page is loaded you can see it when viewing the source.

    so here is how the html looks like:
    <td colspan=4 class=stext id="requiredFieldsLabel">
    <font color=red>=</font> Required Fields<p></td>

    so once the page load something like windows.load=function() I want to chnage the color of the = sign to white.

  4. #4
    SitePoint Wizard Stomme poes's Avatar
    Join Date
    Aug 2007
    Location
    Netherlands
    Posts
    10,276
    Mentioned
    50 Post(s)
    Tagged
    2 Thread(s)
    Damn, it's too bad they used font tags... I'm not completely sure if a font tag can override external CSS like style="color: red;" inline styles can... first see if you can do it with CSS.
    #requiredFieldsLabel>font {color: #fff;}

    But if the font tag is indeed able to override, you'll wnat Js to find whatever's special about that = sign (so if it's only the one inside a td with the id I see you listed, JS would gather the td with that id) and then move to the font tag, and then the font tag's nodeValue (since colour gets inherited, you should be able to just set it on the tag itself).

    So an example of some pseudo code would be

    var td = document.getElementById('requiredFieldsLabel');
    var font = td.firstChild;
    font.style.color = "white";

    I believe you can also use hex numbers but I'm not entirely sure.

    Anyway, it would be something like that.

    Font tags make me shudder. : )


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •