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

Generating checked checkboxes

Have a long scrolling list of checkboxes and I want to move the checked
checkboxes into an adjacent div, works on firefox, but ie wont let them be
checked, is this doable? Failing that does anyone know of a way to do this
with multiselects without requiring ctrl click?

function selectfield(o){
var checked_owner_container =
document.getElementById('checked_owner_container') ;
var row = o.parentNode;
var new_checkbox = row.cloneNode(true);
var checked_box = new_checkbox.firstChild;
checked_box.checked = true;
checked_box.onclick=function(){deselectfield(this) ;}
checked_owner_container.appendChild(new_checkbox);
}
Nov 29 '05 #1
2 1332

James Carters wrote:
Have a long scrolling list of checkboxes and I want to move the checked
checkboxes into an adjacent div, works on firefox, but ie wont let them be
checked, is this doable? Failing that does anyone know of a way to do this
with multiselects without requiring ctrl click?

function selectfield(o){
var checked_owner_container =
document.getElementById('checked_owner_container') ;
var row = o.parentNode;
var new_checkbox = row.cloneNode(true);
var checked_box = new_checkbox.firstChild;
checked_box.checked = true;
checked_box.onclick=function(){deselectfield(this) ;}
checked_owner_container.appendChild(new_checkbox);
}
AFAIK, IE does not let you set the checked property until the element
has been added to the document tree.

Try re-ordering your code by appending earlier:-

var new_checkbox = row.cloneNode(true); checked_owner_container.appendChild(new_checkbox);

var checked_box = new_checkbox.firstChild;
checked_box.checked = true;
checked_box.onclick=function(){deselectfield(this) ;}

Regards

Julian

Nov 29 '05 #2
Thanks, perfect

"Julian Turner" <ju****@baconbutty.com> wrote in message
news:11**********************@g49g2000cwa.googlegr oups.com...

James Carters wrote:
Have a long scrolling list of checkboxes and I want to move the checked
checkboxes into an adjacent div, works on firefox, but ie wont let them be checked, is this doable? Failing that does anyone know of a way to do this with multiselects without requiring ctrl click?

function selectfield(o){
var checked_owner_container =
document.getElementById('checked_owner_container') ;
var row = o.parentNode;
var new_checkbox = row.cloneNode(true);
var checked_box = new_checkbox.firstChild;
checked_box.checked = true;
checked_box.onclick=function(){deselectfield(this) ;}
checked_owner_container.appendChild(new_checkbox);
}


AFAIK, IE does not let you set the checked property until the element
has been added to the document tree.

Try re-ordering your code by appending earlier:-

var new_checkbox = row.cloneNode(true);
checked_owner_container.appendChild(new_checkbox);

var checked_box = new_checkbox.firstChild;
checked_box.checked = true;
checked_box.onclick=function(){deselectfield(this) ;}

Regards

Julian

Nov 29 '05 #3

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

Similar topics

2
by: Pete | last post by:
There is a Summary/Example further down... On page one of my site I have a form with some checkboxes and detailed descriptions. When the form is submitted (to page two), the values of the...
4
by: RodBillett | last post by:
I have a situation where I have 3 checkboxes - and at least 1 needs to be selected at all times... I have implemented the code that allows this behavior to happen, BUT Viewstate gets all messed...
2
by: Andrew | last post by:
Hi, I have a problem capturing the checkboxes that are checked, I get false irrespective of wether they are checked or not. I have gone thru the sample code on this forum, but they dun seem to...
1
by: Kevin R | last post by:
This is one of the weirdest problems I have ever run into. I have had to trim down a bunch of code to give a sample that is more easily readable by those who will view this. Here is the problem:...
5
by: ameshkin | last post by:
What I want to do is very simple, but I'm pretty new at PHP and its a little hard for me. I have one page, where there are a rows of checkboxes. A button selects all checkboxes, and then...
4
by: haresh.amis | last post by:
hello to all, I m using .net 2.0 and i face a problem that is as under Well I have a checkboxlist which i bound in .cs page now I want to count that how many checkboxes ate checked ( In...
5
by: c_shah | last post by:
using VB.net (2005) ASP.net 2.0 I have a repeater control with the item template, in the item template I have two checkboxes How to capture event When user checks the checkboxes? What event...
0
by: cyberdawg999 | last post by:
Greetings all in ASP land I have overcome one obstacle that took me 2 weeks to overcome and I did it!!!!! I am so elated!! thank you to all who invested their time and energy towards helping me...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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
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
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...

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.