473,320 Members | 2,006 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Problem with hiding div inside table

ashsa
45
I use the following fragment in my html page and I tried using the document.getElementById().style.display='none' to hide the div or the row but neither works..

<table>
<form>
<tr id='myrow'>
<td><div id="divi" title='mydiv'></div></td>
</tr>
</form>
</table>

<input type="submit" name='go' value="Go" onclick='reset();return false;'>

function reset(){
document.getElementById('txt1').value="";
document.getElementById('txt2').value="";
document.getElementById('myrow').style.display='no ne';
alert('hidden!!');
}

The functions empties the textboxes but doesnt hide the row or div and also no alert is given !! Could anyone help ??
Feb 28 '07 #1
4 7123
I got it to work like this in IE7:
Expand|Select|Wrap|Line Numbers
  1.  
  2. <html>
  3.  
  4. <head>
  5. <title>Test</title>
  6. </head>
  7.  
  8. <body>
  9. <table>
  10. <form>
  11. <tr id='myrow'>
  12. <td><div id="divi" title='mydiv'>Text Here</div></td>
  13. </tr>
  14. </form>
  15. </table>
  16. <input type="text" name="txt1">
  17. <input type="text" name="txt2">
  18. <input type="submit" name='go' value="Go" onclick='reset();return false;'>
  19. </body>
  20.  
  21. <script language="javascript">
  22. function reset(){
  23. document.getElementById('txt1').value="";
  24. document.getElementById('txt2').value="";
  25. document.getElementById('myrow').style.display='none';
  26. alert('hidden!!');
  27. }
  28. </script>
  29.  
  30. </html>
  31.  
  32.  
Were you forgetting the <script> tag on the java. Try it and see what you get.

Hope it helps
Feb 28 '07 #2
ashsa
45
Thank you Movie King !!
The same thing worked on my System at last :-)
After breaking my head with the prob for about six hours I found that there seems to be an inbuilt function named reset() which i was using for my function ..

Just changed the name of the function and it started working ...

I got it to work like this in IE7:
Expand|Select|Wrap|Line Numbers
  1.  
  2. <html>
  3.  
  4. <head>
  5. <title>Test</title>
  6. </head>
  7.  
  8. <body>
  9. <table>
  10. <form>
  11. <tr id='myrow'>
  12. <td><div id="divi" title='mydiv'>Text Here</div></td>
  13. </tr>
  14. </form>
  15. </table>
  16. <input type="text" name="txt1">
  17. <input type="text" name="txt2">
  18. <input type="submit" name='go' value="Go" onclick='reset();return false;'>
  19. </body>
  20.  
  21. <script language="javascript">
  22. function reset(){
  23. document.getElementById('txt1').value="";
  24. document.getElementById('txt2').value="";
  25. document.getElementById('myrow').style.display='none';
  26. alert('hidden!!');
  27. }
  28. </script>
  29.  
  30. </html>
  31.  
  32.  
Were you forgetting the <script> tag on the java. Try it and see what you get.

Hope it helps
Mar 1 '07 #3
acoder
16,027 Expert Mod 8TB
Thank you Movie King !!
The same thing worked on my System at last :-)
After breaking my head with the prob for about six hours I found that there seems to be an inbuilt function named reset() which i was using for my function ..

Just changed the name of the function and it started working ...
Yes, never use reserved words used in forms and other places, e.g. name, submit, reset, action...

They cause problems in IE, and anyway it's bad practice.
Mar 2 '07 #4
If you are having trouble tracking down errors, make sure any functions that are case-sensitive, such as getElementById(), are typed correctly.
Jan 6 '09 #5

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

Similar topics

8
by: F. Da Costa | last post by:
Following is a snippet of html in which I hide a whole table and try to hide a single row. Here is my question (plz don't chew my head off if its css related instead): Why does the divTable...
1
by: Jason & Juli Cook | last post by:
I have a layer containing a table. The layer is inside a centered containing table. If the layer is hidden, I want the form (surrounding table) to collapse. I want to toggle this effect with a...
5
by: Ben | last post by:
I have a form for data entry which is in a table. I have a select box to enter a customer name, which takes it's options from the customer database. I have a button to add a new customer. What I...
10
by: tbcarver | last post by:
I have a table that I am trying to add a bottom margin to in IE. I have found that if the table is inside more than 1 div then the shape of the containing div collapses. Please look at this...
14
by: Karin Jensen | last post by:
Hi - I am trying to use Javascript to put material inside a table (i.e. alongside the previous material) if the user's screensize is big enough and outide the table (beneath table) if it isn't. ...
1
by: kavithadevan | last post by:
Hi, I am creating websites in my event search form i am have 2 options(which is in radio button)one is countryname and another one is state name with search field(Its in first table).If i run my...
2
by: subramanian100in | last post by:
Is my following understanding correct ? Data abstraction means providing the interface - that is, the set of functions that can be called by the user of a class. Information hiding means...
162
by: Sh4wn | last post by:
Hi, first, python is one of my fav languages, and i'll definitely keep developing with it. But, there's 1 one thing what I -really- miss: data hiding. I know member vars are private when you...
2
by: sirdavethebrave | last post by:
Hi guys - I have written a form, and a stored procedure to update the said form. It really is as simple as that. A user can go into the form, update some fields and hit the update button to...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.