SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast
    Join Date
    May 2002
    Posts
    32
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Interesting innerHTML problem

    Hey all, I'm having another problem with my tab based menu. It is a tabbed menu with subtabs. The problem I seem to be having is this:
    I'm using JavaScript to change the class of my tabs from "tab" to "selTab" (for "selected tab"). I then change the innerHTML of a table column to the new tab's data. It seems that when I first set the innerHTML in the body onload statement (using the "init" function), and "init" sets the innerHTML of the first selected column, the innerHTML becomes "locked" and it will not change, no matter what I do. Does anyone have any ideas? You can take a look at this code at: Tabs. Feel free to play around with it.

    Also, the alert boxes that pop up show the html of the tabContents div (which is the big div that holds all the information) before and after the call to changeTabs(). It also shows when a sub tab is deselected, which is when it should switch from gray to purple.

    And one last thing, I know this code does not work in NN or Mozilla, and probably not in anything else besides IE 5+. This is okay for me because it will only be used in a plant that runs strictly MS software, with IE 5+.

    Thanks,
    Joe Fiorini
    Last edited by jfiorini; May 28, 2002 at 06:11.
    -Joe

  2. #2
    SitePoint Enthusiast
    Join Date
    May 2002
    Posts
    32
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Talking Something worked

    Well, I at least got something working. That makes me very happy, although I don't think it's the best solution available, and if I wasn't pressed for time, I'd work on it some more.

    My fix:

    I noticed that the innerHTML for tabContents was in fact changing correctly after the call to init(). For some reason, however, when going from one tab to another and back, I lost all changes in the contents of innerHTML since the end of the init() call. Therefore, I added a tmp variable to hold the HTML from tabContents and then reload it, only when going back to the first root tab that was loaded. This works for now. If anybody has any better ideas that won't be too difficult to change, let me know.

    Later,
    Joe

    P.S. Source code can still be found at Joe's Tab code
    Last edited by jfiorini; May 28, 2002 at 10:39.
    -Joe


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
  •