HighDots Forums  

<DIV> show/hide...both appear...why oh why?

Javascript JavaScript language (comp.lang.javascript)


Discuss <DIV> show/hide...both appear...why oh why? in the Javascript forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
KathyB
 
Posts: n/a

Default <DIV> show/hide...both appear...why oh why? - 09-26-2003 , 04:03 PM






Hi, totally new to the div show/hide thing.

I have some rows in a table. When I first load the page, I only want
to see divs where the divID=ForView. When I load now, I see BOTH
rows...even though I have one set to style="display='none'".

When I click on the Edit button on a row, I want to hide that row and
in its PHYSICAL place show the ForEdit div for that item...leaving all
other divs as is. I've seen some examples, everyone seems to do it
differently. I'm using ONLY IE5.5 so not worried about multiple
browsers.

I will have quite a few of these divs on one page (e.g., Station2,
Station3, etc.). Would really appreciate any help you can give
me...remember, I'm new at this!

Thanks! Kathy

<div id="ForView_Station1" style="display='block'">
<tr>
<td>Station One</td>
<td colspan="2"><input type="button" name="Edit" value="Edit"
onclick="showhide('Station1')"></input></td>
</tr>
</div>

<div id="ForEdit_Station1" style="display='none'">
<tr>
<td><input type="text" name="Station One" value="Station One"/></td>
<td><input type="button" name="SAVE" value="SAVE"></input></td>
<td><input type="button" name="Cancel" value="Cancel"></input></td>
</tr>
</div>

Reply With Quote
  #2  
Old   
Richard Cornford
 
Posts: n/a

Default Re: <DIV> show/hide...both appear...why oh why? - 09-26-2003 , 07:18 PM






"KathyB" <KathyBurke40 (AT) attbi (DOT) com> wrote

<snip>
Quote:
div id="ForView_Station1" style="display='block'"
snip

The string specified for a STYLE attribute should be in CSS syntax.

Richard.




Reply With Quote
  #3  
Old   
Kathy Burke
 
Posts: n/a

Default Re: <DIV> show/hide...both appear...why oh why? - 09-27-2003 , 09:42 AM



Richard,

Could you please show me? I've copied all the examples I've seen...so I
don't understand what you mean...

thanks.

also, CAN I do <div>s by row like I've done? Or does it have to be some
other way?

Kathy

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Reply With Quote
  #4  
Old   
johkar
 
Posts: n/a

Default Re: <DIV> show/hide...both appear...why oh why? - 09-28-2003 , 06:31 AM



Your style syntax should be: style="display:none"

Also, delete all your div tags as they are incorrect syntax. To do what
you want, just put the ID and style in the TR tag. If you have an ID that
spans multiple rows, you can use the <tbody></tbody> tag to surround the
rows in question (add your ID & style to tbody). You can have as many tbody
tags in a table as you like.

If you really want to get into it, instead of using inline styles, you could
just declare a style rule in the head and assign it as needed in the table.
Once you have this working. The question might be, how can I accomplish
this without creating hidden rows? There are many ways to do this.

Good luck,

John

"KathyB" <KathyBurke40 (AT) attbi (DOT) com> wrote

Quote:
Hi, totally new to the div show/hide thing.

I have some rows in a table. When I first load the page, I only want
to see divs where the divID=ForView. When I load now, I see BOTH
rows...even though I have one set to style="display='none'".

When I click on the Edit button on a row, I want to hide that row and
in its PHYSICAL place show the ForEdit div for that item...leaving all
other divs as is. I've seen some examples, everyone seems to do it
differently. I'm using ONLY IE5.5 so not worried about multiple
browsers.

I will have quite a few of these divs on one page (e.g., Station2,
Station3, etc.). Would really appreciate any help you can give
me...remember, I'm new at this!

Thanks! Kathy

div id="ForView_Station1" style="display='block'"
tr
td>Station One</td
td colspan="2"><input type="button" name="Edit" value="Edit"
onclick="showhide('Station1')"></input></td
/tr
/div

div id="ForEdit_Station1" style="display='none'"
tr
td><input type="text" name="Station One" value="Station One"/></td
td><input type="button" name="SAVE" value="SAVE"></input></td
td><input type="button" name="Cancel" value="Cancel"></input></td
/tr
/div



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.