mynamesleo Posted November 22, 2006 Share Posted November 22, 2006 Hi, I am using the following JS function (found from google) to hide/show table rows[code]{ var tr = document.getElementById(id); if (tr==null) { return; } var bExpand = tr.style.display == ''; tr.style.display = (bExpand ? 'none' : '');}[/code]It works great, but is there a way to set the rows as hidden by default? as when the page is visited all rows are visible/open.Thanks Link to comment https://forums.phpfreaks.com/topic/28084-toggle/ Share on other sites More sharing options...
fenway Posted November 22, 2006 Share Posted November 22, 2006 Sure... add "style=display:hidden"... but that's dangerous for non-JS users. Link to comment https://forums.phpfreaks.com/topic/28084-toggle/#findComment-128613 Share on other sites More sharing options...
mynamesleo Posted November 22, 2006 Author Share Posted November 22, 2006 Thanks for the reply, i am not sure where too add that though, this is the codeI tried add it in table row and data and css? is it for the js script? Link to comment https://forums.phpfreaks.com/topic/28084-toggle/#findComment-128624 Share on other sites More sharing options...
fenway Posted November 22, 2006 Share Posted November 22, 2006 This would be on the TR tag itself. Link to comment https://forums.phpfreaks.com/topic/28084-toggle/#findComment-128628 Share on other sites More sharing options...
mynamesleo Posted November 22, 2006 Author Share Posted November 22, 2006 Sorry but i'm still new to all this,<tr "style=display:hidden">That didn't work, is that what you meant? Link to comment https://forums.phpfreaks.com/topic/28084-toggle/#findComment-128642 Share on other sites More sharing options...
mynamesleo Posted November 22, 2006 Author Share Posted November 22, 2006 Ah, style='display:none' works fine Link to comment https://forums.phpfreaks.com/topic/28084-toggle/#findComment-128809 Share on other sites More sharing options...
fenway Posted November 24, 2006 Share Posted November 24, 2006 sorry, I meant "none"... i was thinking about visibility for some reason -- my bad. Link to comment https://forums.phpfreaks.com/topic/28084-toggle/#findComment-129644 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.