SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Jul 2008
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    If statement looking for a Class name in HTML

    Hi,
    I would like to make my IF STATEMENT to look for a Class name in the HTML called "breadcrumb" instead of looking for the Title Name of the page.

    This is the code a was up to:

    <script type="text/javascript">
    if (document.title == "Rugs"){
    document.getElementById('content').className='template-details';
    }
    </script>

    Thanks.
    Last edited by Luis Grolez; Jul 7, 2008 at 15:36.

  2. #2
    rajug.replace('Raju Gautam'); bronze trophy Raju Gautam's Avatar
    Join Date
    Oct 2006
    Location
    Kathmandu, Nepal
    Posts
    4,013
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Umm do you mean?
    Code javascript:
    if(document.getElementById('breadcumb').className == 'template-list'){
        document.getElementById('content').className='template-details';
    }
    else{
        document.getElementById('content').className='template-list';
    }
    Mistakes are proof that you are trying.....
    ------------------------------------------------------------------------
    PSD to HTML - SlicingArt.com | Personal Blog | ZCE - PHP 5

  3. #3
    SitePoint Member
    Join Date
    Jul 2008
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm good now
    Thanks


Tags for this Thread

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
  •