473,289 Members | 1,953 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,289 software developers and data experts.

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="expandWin()">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.getElementById("showHide").style.visibili ty="hidden";
}
but divs within above div don't get hide.

one way is to loop through all divs and made their visibility="hidden"
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 8401
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="expandWin()">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.getElementById("showHide").style.visibili ty="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="hidden"
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="expandWin()">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.getElementById("hideable").style.visibili ty="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=hideable" text box to hide it

Jan 14 '07 #3
ali wrote on 14 jan 2007 in comp.lang.javascript:
i need you help regarding div hide and show. i am having a link like
<a href="#" onClick="expandWin()">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.getElementById("hideable").style.visibili ty="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=hideable" text box to hide it
and do:

document.getElementById("hideable").style.visibili ty="hidden";

or do:

document.getElementById("hideable").style.visibili ty="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.getElementById(id).childNodes
for (i=0;i<el.length;i++)
if (el[i].firstChild.className == 'hideable' + n)
el[i].firstChild.style.visibility =
(el[i].firstChild.style.visibility=='')?'hidden':'';
}

</script>

<div id='showHide'>
<div>something else</div>
<div>
<input type='text' name='hideable' class='hideable1'
value='input 1 want to show/hide this on click event'>
</div>
<div>
<input type='text' name='hideable' class='hideable2'
value='input 2 want to show/hide this on click event'>
</div>
<div>
<input type='text' name='hideable' class='hideable3'
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="expandWin()">show/hide </a>
here is i try to hide showHide by calling function
function hideWin()
{
document.getElementById("hideable").style.visibili ty="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.getElementById("div3.1").style;
d.visibility = d.visibility==""? "hidden" : "";
}

Or to switch between show and hide :

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

<a href="#" onclick="ShowHide('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_name, element_name) {
document.forms[form_name].elements[element_name].style.visibility='hidden';
}

<a href="#" onclick="hidder('myForm','hideable');">
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.getElementById(idDiv).style.visibility = "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
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...
1
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...
1
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: ...
47
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...
1
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...
4
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 & "','" &...
9
by: trint | last post by:
How can I retrieve all of the data from a datagridview? Any help is appreciated. Thanks, Trint
10
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...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
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: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
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: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
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...

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.