myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Guido Dubois (JIRA)" <...@myfaces.apache.org>
Subject [jira] Created: (TOBAGO-331) onload for <tc:tab> tag
Date Thu, 22 Mar 2007 02:44:32 GMT
onload for <tc:tab> tag
-----------------------

                 Key: TOBAGO-331
                 URL: https://issues.apache.org/jira/browse/TOBAGO-331
             Project: MyFaces Tobago
          Issue Type: New Feature
          Components: Core
    Affects Versions: 1.0.10
            Reporter: Guido Dubois


I want to execute some javascript code when changing a tab pane.

I want to change the background color of several tab panes to highligth the access state in
the app. For this I had to change the style class "tobago-tab-content". But the div container
with this class has no id so it is impossible to access the element from a bean.

With this javascript code, I am able to change the color:

setBgColorOfElement('div', 'tobago-tab-content', '#E0FFE0');

function setBgColorOfElement(element, class, color) {
  elements = document.getElementsByTagName(element);

  for (i = 0; i < elements.length; i++) {
    if (elements[i].className == class) {
      elements[i].style.background = color;
    }
  }
}


First I tryed to place a <tc:script> tag at the end of the tab pane page. But the code
is moved to the top of the page. Then the script is executed too early so that the elements
not exist yet.

If I use <tc:script onload="setBgColorOfElement('div', 'tobago-tab-content', '#E0FFE0')"
/> the call is moved to the top into the function

Tobago.applicationOnload = function() {
  Tobago.setElementWidth('page:_idJsp0', Tobago.getBrowserInnerWidth());
  setBgColorOfElement('div', 'tobago-tab-content', '#E0FFE0')

  return true;
}

In this case the background changes only if the entire page is loaded.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message