td under div

Reply

Join Date: Jul 2008
Posts: 5
Reputation: abs0lut01 is an unknown quantity at this point 
Solved Threads: 0
abs0lut01 abs0lut01 is offline Offline
Newbie Poster

td under div

 
0
  #1
Jul 28th, 2008
HTML and CSS Syntax (Toggle Plain Text)
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  5. <title>Untitled Document</title>
  6. </head>
  7.  
  8. <body>
  9. <table>
  10. <tr>
  11. <td></td><td></td>
  12. <div id="myDiv" style="display: none">
  13. <input type="text" /><input type="text" /><input type="text" />
  14. </div></tr></table>
  15. <a href="#" onclick="if(document.getElementById('myDiv').style.display=='block'){ document.getElementById('myDiv').style.display='hidden'; } else{ document.getElementById('myDiv').style.display='block';}">Show</a>
  16. </body>
  17. </html>
The 3 input text will show if I click the Show link. I need to table the 3 input text.
please help me...
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 317
Reputation: Thirusha is an unknown quantity at this point 
Solved Threads: 51
Thirusha's Avatar
Thirusha Thirusha is offline Offline
Posting Whiz

Re: td under div

 
0
  #2
Jul 28th, 2008
Can u give a further explanantion, i dont understand what u want to do.
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 142
Reputation: mexabet is an unknown quantity at this point 
Solved Threads: 9
mexabet's Avatar
mexabet mexabet is offline Offline
Junior Poster

Re: td under div

 
1
  #3
Jul 28th, 2008
Since you didn't explain in details, I can only guess. If structuring the three text fields with a table is your need, see if this modification helps:

HTML and CSS Syntax (Toggle Plain Text)
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  5. <title>Untitled Document</title>
  6. </head>
  7.  
  8. <body>
  9. <div id="myDiv" style="display: none">
  10. <table width="100%" border="0" align="center" cellpadding="0" cellspacing="4">
  11. <tr>
  12. <td>Text 1</td>
  13. <td><input type="text" name="textfield" /></td>
  14. </tr>
  15. <tr>
  16. <td>Text 2</td>
  17. <td><input type="text" name="textfield2" /></td>
  18. </tr>
  19. <tr>
  20. <td>Text 3</td>
  21. <td><input type="text" name="textfield3" /></td>
  22. </tr>
  23. </table>
  24. </div>
  25. <a href="#" onclick="if(document.getElementById('myDiv').style.display=='block'){ document.getElementById('myDiv').style.display='hidden'; } else{ document.getElementById('myDiv').style.display='block';}">Show</a>
  26. </body>
  27. </html>
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 5
Reputation: abs0lut01 is an unknown quantity at this point 
Solved Threads: 0
abs0lut01 abs0lut01 is offline Offline
Newbie Poster

Re: td under div

 
0
  #4
Jul 28th, 2008
HTML and CSS Syntax (Toggle Plain Text)
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  5. <title>Untitled Document</title>
  6. </head>
  7.  
  8. <body>
  9. <table>
  10. <tr>
  11. <td>text1</td><td>text2</td><td>text3</td>
  12. <div id="myDiv" style="display: none">
  13. <input type="text" /><input type="text" /><input type="text" />
  14. </div></tr></table>
  15. <a href="#" onclick="if(document.getElementById('myDiv').style.display=='block'){ document.getElementById('myDiv').style.display='hidden'; } else{ document.getElementById('myDiv').style.display='block';}">Show</a>
  16. </body>
  17. </html>
I forgot text1, text2 and text3 before the div.. I need to structure the three text fields with a table.. When they click the show button it will show the input fields only..
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 1,072
Reputation: Shanti Chepuru is on a distinguished road 
Solved Threads: 98
Shanti Chepuru's Avatar
Shanti Chepuru Shanti Chepuru is offline Offline
Veteran Poster

Re: td under div

 
0
  #5
Jul 29th, 2008
this is your table having text fields:
  1. <table width="291" id="prl" style="display:none">
  2. <tr>
  3. <td width="95">message</td>
  4. <td width="196"><input name="message" type="text" id="message" ></td>
  5. </tr>
  6. <tr>
  7. <td>name</td>
  8. <td><input name="name" type="text" id="name"></td>
  9. </tr>
  10.  
  11.  
  12. </table>

this is your link to show the text boxes:
HTML and CSS Syntax (Toggle Plain Text)
  1. <a href="#" onClick="toggle_it('prl')">show</a>
include this script in your page:
  1. <script language="javascript">
  2. function toggle_it(itemID){
  3. // Toggle visibility between none and inline
  4. if ((document.getElementById(itemID).style.display == 'none'))
  5. {
  6. document.getElementById(itemID).style.display = 'inline';
  7. } else {
  8. document.getElementById(itemID).style.display = 'none';
  9. }
  10. }
  11. </script>
Be intelligent, But Don't try to cheat.. Be innocent But Don't get cheated..
Reply With Quote Quick reply to this message  
Join Date: May 2008
Posts: 302
Reputation: sreein1986 is an unknown quantity at this point 
Solved Threads: 33
sreein1986's Avatar
sreein1986 sreein1986 is offline Offline
Posting Whiz

Re: td under div

 
0
  #6
Jul 30th, 2008
Originally Posted by Shanti Chepuru View Post
this is your table having text fields:
  1. <script language="javascript">
  2. function toggle_it(itemID){
  3. // Toggle visibility between none and inline
  4. if ((document.getElementById(itemID).style.display == 'none'))
  5. {
  6. document.getElementById(itemID).style.display = 'inline';
  7. } else {
  8. document.getElementById(itemID).style.display = 'none';
  9. }
  10. }
  11. </script>
What is the need of javascript code ....
Thanx,
Shiriyal

http://shiriyal.blogspot.com/
if you problem solved add me as a reputation and mark it mark as solved
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 1,072
Reputation: Shanti Chepuru is on a distinguished road 
Solved Threads: 98
Shanti Chepuru's Avatar
Shanti Chepuru Shanti Chepuru is offline Offline
Veteran Poster

Re: td under div

 
0
  #7
Jul 31st, 2008
Originally Posted by sreein1986 View Post
What is the need of javascript code ....
the table will show after clicks on the show hyperlink:
HTML and CSS Syntax (Toggle Plain Text)
  1. <a href="#" onClick="toggle_it('prl')">show</a>
all this is done by javascript....
Be intelligent, But Don't try to cheat.. Be innocent But Don't get cheated..
Reply With Quote Quick reply to this message  
Join Date: Jan 2007
Posts: 3,210
Reputation: MidiMagic has a spectacular aura about MidiMagic has a spectacular aura about 
Solved Threads: 164
MidiMagic's Avatar
MidiMagic MidiMagic is offline Offline
Nearly a Senior Poster

Re: td under div

 
0
  #8
Jul 31st, 2008
This is a fundamental HTML error.

The div tag cannot have the table tag or the tr tag as its parent. It must be either outside the table, or inside a td tag. And the only legal parent of a td tag is a tr tag.

Also, note that some browsers have trouble displaying a structure later, if it is initially not displayed.
Last edited by MidiMagic; Jul 31st, 2008 at 7:57 pm.
Daylight-saving time uses more gasoline
Reply With Quote Quick reply to this message  
Join Date: Jun 2008
Posts: 55
Reputation: rexibit is an unknown quantity at this point 
Solved Threads: 3
rexibit rexibit is offline Offline
Junior Poster in Training

Re: td under div

 
0
  #9
Aug 5th, 2008
Well spotted Midi.

One thing that should also be pointed out is that Javascript should not be used for site functionality. If someone doesn't have JS enabled (a number of companies have it disabled on all employee computers), then they won't be able to use the form.

If you "must" hide the table, then consider using CSS's visibility attribute.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the HTML and CSS Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC