473,320 Members | 1,955 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.

making a Horizontal Rule visible and not visible

69
Hi Guys,

Can a horizontal rule be visible and not visible within the <td> tag of a row on a table?
Expand|Select|Wrap|Line Numbers
  1.  <tr>
  2.        <td colspan="4" style="height: 20px; text-align: left" valign="middle">
  3.                 <hr id ="hr" style="width: 75%" visible="false" >                 
  4.          </td>
  5. </tr>
  6.  
I tried the above code and it is not working, the horizontal rule is always visible.
i attached an id to it because i wanted to code when it should be visible or not.
May 20 '08 #1
3 1677
Curtis Rutland
3,256 Expert 2GB
Use:
Expand|Select|Wrap|Line Numbers
  1. <hr id="hr1" style="visibility:hidden; width:75%;" />
Then you can change it with javascript:
Expand|Select|Wrap|Line Numbers
  1. function showHide()
  2.         {
  3.             elem = document.getElementById("hr1");
  4.             if(elem.style.visibility == 'hidden')
  5.                 elem.style.visibility = 'visible';
  6.             else   
  7.                 elem.style.visibility = 'hidden';
  8.         }
  9.  
Hi Guys,

Can a horizontal rule be visible and not visible within the <td> tag of a row on a table?
Expand|Select|Wrap|Line Numbers
  1.  <tr>
  2.        <td colspan="4" style="height: 20px; text-align: left" valign="middle">
  3.                 <hr id ="hr" style="width: 75%" visible="false" >                 
  4.          </td>
  5. </tr>
  6.  
I tried the above code and it is not working, the horizontal rule is always visible.
i attached an id to it because i wanted to code when it should be visible or not.
May 20 '08 #2
phpmel
69
thank you, that works

is there also a way to change it with c# using the id?
May 20 '08 #3
Curtis Rutland
3,256 Expert 2GB
Sure. Change it to:
Expand|Select|Wrap|Line Numbers
  1. <hr id="hr1" runat="server" style="visibility:hidden; width:75%;" />
  2.  
The 'runat="server"' lets you manipulate it in the code. Here's how:

Expand|Select|Wrap|Line Numbers
  1. string value = hr1.Style["visibility"];
  2. if (value == "hidden")
  3.     hr1.Style["visibility"] = "visible";
  4. else
  5.     hr1.Style["visibility"] = "hidden";
  6.  
The difference between the C# version and the Javascript version is that the C# version will require a page refresh. The Javascript executes on the client side.

thank you, that works

is there also a way to change it with c# using the id?
May 20 '08 #4

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

Similar topics

6
by: Francesco Moi | last post by:
Hello I want to insert an horizontal rule into my HTML page, but without using <HR> or <HR size=1>, as I consider it oldfashioned. Does anybody know a good way? Thank you very much.
3
by: Christian Zenner | last post by:
Hi, how can I make a horizontal rule (<hr>) 1px thin? Border: 1px; doesn't work. Anybody has an idea? Thanks, Chris
1
by: Peter Mount | last post by:
Hi When I zoom into my site (http://www.petermount.au.com) with Opera 7.54 the horizontal scrollbar doesn't show when the site image is bigger than my screen. Yet the horizontal scrollbar shows...
2
by: Griff | last post by:
What I'm trying to achieve is to have a title followed by a horizontal rule on the same line. For example: Living on Mars ---------------- Living on Mars would be at best impractical for the...
10
by: lothar | last post by:
for the horizontal rule element, the w3c HTML 4.01 specification http://www.w3.org/TR/html4/cover.html states that the align, noshade, size and width attributes are deprecated. it gives an...
9
by: tshad | last post by:
I have a datagrid that I want to add a new column to. This column will only be visible under certain conditions. So I want to set the column visible=false. Then when the right condition happens...
1
by: Miguel Dias Moura | last post by:
Hello, I have a GridView in my page which is created in runtime. It works fine. My page has 2 Asp Buttons: - The HIDE button makes GridView.Visible = False; - The SHOW button makes...
14
by: Haines Brown | last post by:
I know I'm missing something obvious. I need a short horizontal rule to preceed a line of text (in a bibliography in which the author is repeated). I tried this: <p> <div class="rule"></div>,...
3
by: phpmel | last post by:
Hi Guys, Can a horizontal rule be visible and not visible within the <td> tag of a row on a table? <tr> <td colspan="4" style="height: 20px; text-align: left" valign="middle"> ...
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...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
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)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
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.