473,404 Members | 2,114 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.

toggle node with checkbox

Hello,

I currently have a hyperlink to toggle the node, showing and hiding
the list. Could someone show me how to use a checkbox instead of the
hyperlink to do the same thing? Thanks.
I tried the following line but the node's nextSibling becomes
[<u>Fruits:</u>] instead of <div>. Then I tried node.
nextSibling.nextSibling but it didn't work. Please help!

<input type="checkbox" onclick="Toggle(this)" id="Fruits"><u>Fruits:</
u><div>

===========

<html>

<script language="JavaScript">

function Open(node)
{

node.nextSibling.style.display = '';
}

function Close(node)
{

node.nextSibling.style.display = 'none';
}

function Toggle(node)
{

if (node.nextSibling.style.display == 'none')
{
Open(node);
}

else
{
Close(node);
}

}

</script>
<a onclick="Toggle(this)" id="Fruits"><u>Fruits:</u></a><div>
<table>
<tr>
<td>Orange</td>
<td>Apple</td>
<td>Pearl</td>
</tr>
</table>
</div>

</html>
Oct 12 '08 #1
1 2975
On 2008-10-12 07:23, st***********@gmail.com wrote:
I currently have a hyperlink to toggle the node, showing and hiding
the list. Could someone show me how to use a checkbox instead of the
hyperlink to do the same thing? Thanks.
I tried the following line but the node's nextSibling becomes
[<u>Fruits:</u>] instead of <div>. Then I tried node.
nextSibling.nextSibling but it didn't work. Please help!
node.nextSibling.nextSibling will work if you change it in all three
functions.

Before you wonder your script isn't working as expected, check your
HTML. What you're using in your test isn't remotely valid:
http://validator.w3.org/
- Conrad
Oct 12 '08 #2

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

Similar topics

1
by: discomiller | last post by:
Mario Mueller: Hello *, radiobuttons belong to other radiobuttons by the "name="any_value"" attribut. Thats a fakt. I got the following XML:...
4
by: Alan Carpenter | last post by:
I'm not a Newbie but I feel like one right now. Here's what I did to reproduce a simple, simple problem. 1. Create a new Database. 2. Create a new Form. 3. Create a CheckBox on the form....
4
by: deko | last post by:
Basic question about checking the value of Toggle/Check/Combo/OptionGroups.... Checking like this: If Me!chkCheckBox Then ... End If and like this:
1
by: sam | last post by:
Hi All, I have a form with 4 checkboxes and 4 text boxes and one submit button. The form should work such a way when I select a particular checkbox and give a url in text box, the form should...
2
by: John Smith | last post by:
How can I use a transparent command button to change a checkbox? I have my records set up in a continuous form and I want theuser to be able to click on the record and have this toggle the...
2
by: sicapitan | last post by:
FYI, with something like this: hotelement = "hotelement"+hotcount; hotspot = Builder.node('div', { id:'hotspot'+hotcount, className:'hotspot', style:''+divstyle }, ) ]);
3
by: mrlk | last post by:
i have the following but would like to use a img button rather than a checkbox - is this possible? function toggleZoom(isChecked) { if (isChecked) { ...
4
by: zufie | last post by:
I have two checkboxes on a form, ChckIBCCP and ChckOtherReferral. Each checkbox highlights its respective textboxes and combo boxes on the form. Many of the highlighted textboxes and combo...
4
by: ameshkin | last post by:
I have a checkbox with an ID of svc_tp_1, and an image that corresponds with this checkbox below it. <input type="checkbox" name="checkbox" id="svc_tp_1" value="svc_tp_1" / <img...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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...
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
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.