473,569 Members | 2,793 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

making a Horizontal Rule visible and not visible

69 New Member
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 1691
Curtis Rutland
3,256 Recognized Expert Specialist
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 New Member
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 Recognized Expert Specialist
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
21221
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
12437
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
3214
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 in print preview and when I turn css off in Opera. Could it be a problem with my css? The code is: html{ padding-top: 0; padding-bottom: 0;
2
4234
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 following reasons: blah blah blah Living on Earth --------------- Life has evolved on earth for
10
2944
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 example using the deprecated attributes, but no indication as to how to avoid the deprecated attributes. what CSS properties can be used to replace...
9
3170
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 to change it to visible=true. You can't do that with a bound column (no ID), but you can create a templatecolumn with a label. To make these...
1
9340
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 GridView.Visible = True. I press HIDE and the GridView disappears as expected. After it I press SHOW and the GridView doesn't show.
14
3122
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>, Title of book ... </p> style:
3
8264
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"> <hr id ="hr" style="width: 75%" visible="false" > </td> </tr>
0
7695
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
8119
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7668
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6281
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5509
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5218
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3653
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3637
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
936
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.