473,591 Members | 2,810 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help about div hide/show

ali
Hello every one

i need you help regarding div hide and show. i am having a link like
<a href="#" onClick="expand Win()">show/hide </a>
<div id=showHide>

</div>
within div i have lots of form tags and div elements say n. The problem
here is i try to hide showHide by calling function
function hideWin()
{

document.getEle mentById("showH ide").style.vis ibility="hidden ";
}
but divs within above div don't get hide.

one way is to loop through all divs and made their visibility="hid den"
but it can't work for me as i have to hide a particular portion of web
page and no of divs within that protion is unknown. and making all divs
hidden by getElementByID( DivId) is impractial and overhead

any solution..

Jan 12 '07 #1
5 8423
ASM
ali a écrit :
Hello every one

i need you help regarding div hide and show. i am having a link like
<a href="#" onClick="expand Win()">show/hide </a>
<div id=showHide>

</div>
within div i have lots of form tags and div elements say n. The problem
here is i try to hide showHide by calling function
function hideWin()
{

document.getEle mentById("showH ide").style.vis ibility="hidden ";
}
but divs within above div don't get hide.
What do you mean by "above" divs ?
previous divs ?
or
divs displayed over the showHide div ?
or
divs contained by showHide ?
one way is to loop through all divs and made their visibility="hid den"
but it can't work for me as i have to hide a particular portion of web
page and no of divs within that protion is unknown. and making all divs
hidden by getElementByID( DivId) is impractial and overhead

any solution..
Your page as described seems curiously built ...
(all elements in absolute, no ?)
--
Stephane Moriaux et son (moins) vieux Mac déjà dépassé
Stephane Moriaux and his (less) old Mac already out of date
Jan 12 '07 #2
ali
i need you help regarding div hide and show. i am having a link like
<a href="#" onClick="expand Win()">show/hide </a>
<div id=showHide>

</div>
within div i have lots of form tags and div elements say n. The problem
here is i try to hide showHide by calling function
function hideWin()
{
document.getEle mentById("hidea ble").style.vis ibility="hidden ";
}
>
What do you mean by "above" divs ?
previous divs ?
or
divs displayed over the showHide div ?
or
divs contained by showHide ?
By divs i mean divs contined by show hide
<div id="showHide">
<div id="div1"></div>
<div id="div2"></div>
<div id="div3">
<div id="div3.1">
<input type="text" name="hideable" value="want
to hide this text on click event">
</div>
</div>

</div>
>
Your page as described seems curiously built ...
(all elements in absolute, no ?)
--
Stephane Moriaux et son (moins) vieux Mac déjà dépassé
Stephane Moriaux and his (less) old Mac already out of date
how can i access "id=hideabl e" text box to hide it

Jan 14 '07 #3
ali wrote on 14 jan 2007 in comp.lang.javas cript:
i need you help regarding div hide and show. i am having a link like
<a href="#" onClick="expand Win()">show/hide </a>
<div id=showHide>

</div>
within div i have lots of form tags and div elements say n. The problem
here is i try to hide showHide by calling function
function hideWin()
{
document.getEle mentById("hidea ble").style.vis ibility="hidden ";
}
>>
What do you mean by "above" divs ?
previous divs ?
or
divs displayed over the showHide div ?
or
divs contained by showHide ?
By divs i mean divs contined by show hide
<div id="showHide">
<div id="div1"></div>
<div id="div2"></div>
<div id="div3">
<div id="div3.1">
<input type="text" name="hideable"
add this:

id="hideable"
value="want
to hide this text on click event">
</div>
</div>

</div>
>>
Your page as described seems curiously built ...
(all elements in absolute, no ?)

how can i access "id=hideabl e" text box to hide it
and do:

document.getEle mentById("hidea ble").style.vis ibility="hidden ";

or do:

document.getEle mentById("hidea ble").style.vis ibility="div3.1 ";

Remember, on a page the id's need to be named uniquely!

However, perhaps you want something like this:

=============== =============== =============== ===
<script type='text/javascript'>

function toggle(id,n) {
var el = document.getEle mentById(id).ch ildNodes
for (i=0;i<el.lengt h;i++)
if (el[i].firstChild.cla ssName == 'hideable' + n)
el[i].firstChild.sty le.visibility =
(el[i].firstChild.sty le.visibility== '')?'hidden':'' ;
}

</script>

<div id='showHide'>
<div>somethin g else</div>
<div>
<input type='text' name='hideable' class='hideable 1'
value='input 1 want to show/hide this on click event'>
</div>
<div>
<input type='text' name='hideable' class='hideable 2'
value='input 2 want to show/hide this on click event'>
</div>
<div>
<input type='text' name='hideable' class='hideable 3'
value='input 3 want to show/hide this on click event'>
</div>
</div>

<a href='#' onClick='toggle ("showHide",1)' >show/hide 1</a><br>
<a href='#' onClick='toggle ("showHide",2)' >show/hide 2</a><br>
<a href='#' onClick='toggle ("showHide",3)' >show/hide 3</a><br>
=============== =============== =============== ===

only ie7 tested!

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jan 14 '07 #4
ASM
ali a écrit :
i need you help regarding div hide and show. i am having a link like
<a href="#" onClick="expand Win()">show/hide </a>
here is i try to hide showHide by calling function
function hideWin()
{
document.getEle mentById("hidea ble").style.vis ibility="hidden ";
}

<div id="showHide">
<div id="div1"></div>
<div id="div2"></div>
<div id="div3">
<div id="div3.1">
<input type="text" name="hideable"
value="want to hide this text on click event">
</div>
</div>
</div>
In fact you want to hide the div 'div3.1' no ?

If yes :
function hideWin() {
var d = document.getEle mentById("div3. 1").style;
d.visibility = d.visibility==" "? "hidden" : "";
}

Or to switch between show and hide :

function ShowHide(idDiv) {
var d = document.getEle mentById(idDiv) .style;
d.visibility = d.visibility==" "? "hidden" : "";
return false;
}

<a href="#" onclick="ShowHi de('div3.1');">
show/hide div 'div3.1'
</a>
Now, if you want to hide an element of your form, it is better to call
this element by forms tree :

function hidder(form_nam e, element_name) {
document.forms[form_name].elements[element_name].style.visibili ty='hidden';
}

<a href="#" onclick="hidder ('myForm','hide able');">
hide textfield "hideable"
</a>
--
Stephane Moriaux et son (moins) vieux Mac déjà dépassé
Jan 14 '07 #5
ASM
ASM a écrit :
>
In fact you want to hide the div 'div3.1' no ?

If yes :
function Hide(idDiv) {
document.getEle mentById(idDiv) .style.visibili ty = "hidden";
return false;
}

<a href="#" onclick="Hide(' div3.1');">
hide div 'div3.1' and its textfield
</a>

--
Stephane Moriaux et son (moins) vieux Mac déjà dépassé
Stephane Moriaux and his (less) old Mac already out of date
Jan 14 '07 #6

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

Similar topics

5
1451
by: Ed Jay | last post by:
I have a switch statement that controls which of several containers is displayed or not. It currently looks like: function showHelp(n) { show('vhelp'); //makes parent container visible switch (n){ case 0: show('image0');hide('image1');hide('image2');...;hide('imagem'); break; ..
1
1334
by: Brenton | last post by:
Hi I'm new to the group so if I make a major blunder posting this here I apologise in advance. I'm not a Programmer by any stretch of the imagination and I've been trying to sort out a small JavaScript that I found here: http://www.interspire.com/content/articles/10/1/Building-An-Expanding-DHTML-Menu-With-CSS-and-JavaScript if I use what is supplied it works fine, but a little further down
1
4938
by: Bob | last post by:
Hi, Hope you can help me with this one. I'm at my wits end. I'm trying to create an intelligent edit-box like the excellent "Customer" one at the URL: http://munich.schwarz-interactive.de/autocomplete.aspx
47
2849
by: Jo | last post by:
Hi there, I'm Jo and it's the first time I've posted here. I'm in process of creating a database at work and have come a little unstuck.....I'm a bit of a novice and wondered if anyone could help. I work in a library and send out dual language books to babies of dual or other nationality. The db is to be used for logging a range of book titles and numbers ordered and books sent out to individuals. I am trying to work out a way of...
1
3447
by: Mike Bahr | last post by:
Hi All, Im not very well versed in javascript at all so hoping someone can help me out here. I have a page that uses pairs of radio buttons to toggle visibility of some table columns. I need to convert the radio button pairs to a single checkbox so Im thinking just a function to check the status of the checkbox and "SHOW" if checked, and "HIDE" if not checked.
4
1480
by: Ron | last post by:
I am having a bit of problem with this code: Dim cmd As New OleDb.OleDbCommand("INSERT INTO help (Name, Email, telephone, description)VALUES('" & txtName.Text & "','" & txtEmail.Text & "','" & txtTelephone.Text & "','" & txtDescription.Text & "')", New OleDb.OleDbConnection(strconn)) at the end, strconn is underlined in blue and says not defined, I dont know what to do with this, how do I define it?
9
2673
by: trint | last post by:
How can I retrieve all of the data from a datagridview? Any help is appreciated. Thanks, Trint
10
1563
by: supercrossking | last post by:
I am trying to the values of string of text in the sample before. The ds are for digits and s is for string and string of text is for a string with more than one or two values. I am trying to use regex and the .groups method. Please help. d|d|d|string of text 1||s|s|||dd.dd|ss|string of text 2||||||||||||||||||||||||||string of text 2 I only want string of text1
0
7934
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
7870
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8236
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8362
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
7992
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 most users, this new feature is actually very convenient. If you want to control the update process,...
1
5732
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5400
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3850
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
1199
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.