[thelist] 1.1.2 Sorting
.jeff
jeff at members.evolt.org
Fri Dec 6 17:13:00 CST 2002
max,
><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
> From: Max Kanat-Alexander
>
> It was really just a chance to flex my geek muscles,
> something I'm always raring to do.
><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
aren't you the same person that said you like to use coldfusion's <cfform>
and <cfinput> tags? why not flex your geek muscles there and resist the
urge to use those cf_newbie tags?
;p
j/k. couldn't resist.
<tip type="JavaScript" author=".jeff">
Passing an object reference to a form element that shares its name with
other form elements on the page is likely going to not yield the results
you're looking for:
function toggleChecked(oElement)
{
alert(oElement.length);
// you'd think this would return the number of elements
// that share this element's name.
}
<input type="checkbox" name="archive" onclick="toggleChecked(this)"
value="0" />
<input type="checkbox" name="archive" value="1" />
clicking the first checkbox results in an alert() dialog that contains the
string "undefined". instead, you'll have to perform alittle bit of dom 0
gymnastics to get what you're looking for.
function toggleChecked(oElement)
{
var oForm = oElement.form;
var oElement = oForm.elements[oElement.name];
alert(oElement.length);
}
clicking the first checkbox will now result in an alert() dialog that
contains the number 2, what you'd expect.
</tip>
.jeff
http://evolt.org/
jeff at members.evolt.org
http://members.evolt.org/jeff/
More information about the thelist
mailing list