Welcome to Dream.In.Code
Getting Help is Easy!

Join 109,492 Programmers for FREE! Ask your question and get quick answers from experts. There are 1,176 online right now! We've got more than 500 tutorials and 2,000 snippets. Join and find out why Dream.In.Code is the #1 programming help community on the internet! Registration is fast and FREE... Join Now!



display property of row

 
Reply to this topicStart new topic

display property of row

samn84
post 23 Jun, 2008 - 09:45 PM
Post #1


New D.I.C Head

*
Joined: 21 Feb, 2008
Posts: 41

well i have a row which consist of a table and i have set the rows property to none.when the link is clicked the row propert is set to display that row-but the row consisting of the table is always shown either i click it or i dont!

the code is as follows,this the javascript function for displaying the row:
CODE

<script language="javascript">
function fn(id)
{
document.write(id);
if(id=='link_city')
{
document.write("print table");
document.getElementById('tab_city').style.display = '';
}
</script>


it goes in the function once the link is clicked and prints "print table" but dsnt do any thing afta that

Now here is the code where the links and the row+table are
CODE

<html>
<head><title>ADD ORGANIZATION INFORMATION</title></head>
<body>

<tr>
<td>
<form name="add_orginfo" action="" method="post">
<a href="#" id='link_city' onclick="fn('link_city')">CITY</a>
</td>
</tr>


<tr id='tab_city' style='display:none;'>
<td>
<table  border=1>
<tr><td>kk</td></tr>
<tr><td>ll</td></tr>
</table>
</td>
</tr>


now when the page is shown the first time row+table is still displayed thoughthe row was set to null.
i dono wat to do?

Any help/suggestions wud be appreciated!
User is offlineProfile CardPM

Go to the top of the page


no2pencil
post 23 Jun, 2008 - 11:02 PM
Post #2


Wet D.I.C.

Group Icon
Joined: 10 May, 2007
Posts: 4,942



Thanked 27 times

Dream Kudos: 2325

Expert In: Goofing Off

My Contributions


** Moved to JavaScript **
User is online!Profile CardPM

Go to the top of the page

BetaWar
post 23 Jun, 2008 - 11:33 PM
Post #3


#include <soul.h>

Group Icon
Joined: 7 Sep, 2006
Posts: 1,260



Thanked 38 times

Dream Kudos: 775
My Contributions


to hid eth etable you should look at doing something like so:

CODE
document.getElementById('tab_city').style.display = 'none';


then you will need to make a check adn see if the table (or row) is displaying or not and if it isn't do this:

CODE
document.getElementById('tab_city').style.display = 'block';


In all it should probably look like so:

CODE
<script language="javascript">
function fn(id){
  document.write(id);
  if(id=='link_city'){
    //document.write("print table");
    obj = document.getElementById('tab_city');
    if(obj.style.display == 'none'){
      obj.style.display = 'block';
    }
    else{
      obj.style.display = 'none';
    }
  }
}
</script>


NOTE - this code hasn't been tested, and as such may not work.

Hopefully that will work for you.
User is offlineProfile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 9/7/08 02:15PM

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month