By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,730 Members | 1,567 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,730 IT Pros & Developers. It's quick & easy.

How to un-hide this table when the page onload !!

P: 2
Originally I need to click on the show button then the table will collapse. But I would like to make it collapse when page onload. Need help on code below !!!

Expand|Select|Wrap|Line Numbers
  1. function KZAdhocBarToggleVisibility(sBarId)
  2.     {
  3.     if ( typeof(Page_KzAdhocBars)== 'undefined')
  4.     {
  5.       return;
  6.     }
  7.     var bar = null;
  8.     for( var iI = 0 ; iI < Page_KzAdhocBars.length ; iI++)
  9.     {
  10.       var o = Page_KzAdhocBars[iI];
  11.       if ( o.BarId == sBarId )
  12.       {
  13.         bar = o;
  14.         break;
  15.       }
  16.     }
  17.     if ( bar == null )
  18.     {
  19.       return;
  20.     }
  21.  
  22.         var obj        = bar.BarBody;
  23.  
  24.         obj.runtimeStyle.display = obj.runtimeStyle.display == 'none' ? '' : 'none';
  25.  
  26.         if ( obj.runtimeStyle.display == 'none' )
  27.         {
  28.             bar.ShowHideCtl.innerText = 'Show';
  29.         }
  30.         else
  31.         {
  32.             bar.ShowHideCtl.innerText = 'Hide';
  33.         }        
  34.         // Update section visible flag
  35.         var propName = '__KzAdhocBarVisible_'+sBarId;
  36.         var theForm = document.forms[0];
  37.         if ( propName in theForm )
  38.         {
  39.             theForm[propName].value    = obj.runtimeStyle.display;
  40.         }            
  41.     }
Nov 9 '07 #1
Share this Question
Share on Google+
3 Replies


gits
Expert Mod 5K+
P: 5,390
hi ...

welcome to TSDN ...

why not call the function then on the body's onload? you may do:

[HTML]<body onload="your_function_call();">
[/HTML]
kind regards
Nov 9 '07 #2

P: 2
hi ...

welcome to TSDN ...

why not call the function then on the body's onload? you may do:

[HTML]<body onload="your_function_call();">
[/HTML]
kind regards
Thanks for your advise. However I cant do so. This is because it is a huge project. I would like to just modify the code mentioned and make it load when page load. Can you help me on that ?
Nov 10 '07 #3

acoder
Expert Mod 15k+
P: 16,027
Use window.onload (link) or the more advanced event registration models (addEventListener/attachEvent), e.g. see link.
Nov 10 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.