473,404 Members | 2,195 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,404 software developers and data experts.

script to hide a control

I have an asp.net page that dynamically generates client-side
javascript. What javascript would hide a control? Specifically, I have
a composite web server control and when the user clicks a button a
postback occurs and the asp code sets the control's visible property
to false, so when the html is sent back, the control is not visible.
Is there a way to do that in javascript and avoid the postback? Second
question: what is a good book or resource that covers such javascript
topics?

bill

May 25 '07 #1
2 7522
On May 25, 9:13 am, billsahi...@yahoo.com wrote:
I have an asp.net page that dynamically generates client-side
javascript. What javascript would hide a control? Specifically, I have
a composite web server control and when the user clicks a button a
postback occurs and the asp code sets the control's visible property
to false, so when the html is sent back, the control is not visible.
Is there a way to do that in javascript and avoid the postback? Second
question: what is a good book or resource that covers such javascript
topics?

bill
There are a few ways to show/hide things in javascript which typically
involved setting the style attributes of an element.

visibility: hidden || visible
display: none || (block || inline)

Simple example:

HTML
-----------
<div id="test">This is a test</div>
<a href="#" onclick="toggle('test');">Toggle It</a>

JavaScript
-----------
function toggle(obj)
{
obj = document.getElementById(obj);
if (obj) {
obj.style.display = (obj.style.display != 'none') ? 'none' :
'block';
}
}

A good reference: http://developer.mozilla.org/en/docs/JavaScript

Hope that helps a bit.

May 25 '07 #2
Perfect. Thank you.

On May 25, 7:27 am, Jeff Johns <phpf...@gmail.comwrote:
On May 25, 9:13 am, billsahi...@yahoo.com wrote:
There are a few ways to show/hide things in javascript which typically
involved setting the style attributes of an element.

visibility: hidden || visible
display: none || (block || inline)

Simple example:
May 25 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Cathryn Lindner | last post by:
I have a web form that has a checkbox on it and a textbox associated with it. I want the textbox to be displayed when the checkbox is checked and I want this to happen on the client-side instead of...
5
by: Steve | last post by:
Visual Studio 2003 C# Windows: I have a tree view control as my main menu control down the left side of my application. This has 2 Parent Nodes on it (Jobs and Employees). beneath these 2 main...
3
by: Magnus Blomberg | last post by:
Hello! I have a client javascript that generates a string (like below). This string should then be used by server code (in this case a function called run). <script language=javascript>...
3
by: sklett | last post by:
I need to add extensive validation and interaction client scripting to a web form. I've done some initial searches for "asp.net and client scripting" and I've found a couple articles that show...
12
by: mantrid | last post by:
Can anyone see why this simple script doesnt make the element visible? It starts of as hidden but will not show when the button is clicked. This has worked for me before but I cannot see what is...
3
by: Angus | last post by:
I have a web page with a toolbar containing a Save button. The Save button can change contextually to be a Search button in some cases. Hence the button name searchsavechanges. The snippet of...
3
by: traceable1 | last post by:
Is there a way I can set up a SQL script to run when the instance starts up? SQL Server 2005 SP2 thanks!
14
by: asdf | last post by:
I have a python script whose output i want to dynamically display on a webpage which will be hosted using Apache. How do I do that? thanks
3
by: aRTx | last post by:
I have try a couple of time but does not work for me My files everytime are sortet by NAME. I want to Sort my files by Date-desc. Can anyone help me to do it? The Script <? /* ORIGJINALI
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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,...
0
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...

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.