function MyFunction(objCheckBox)
{
//Note the use of "firstChild" to access the checkbox
bChecked = objCheckBox.firstChild.checked ? "1" : "0";
}
called from the following code, rendered by .Net 1.0:
<span onclick="javascript:return MyFunction(this);">
<input id="chklstItem_Item1" type="checkbox" name="chklstItem:Item1"
/>
<label for="chklstItem_Item1">Item1</label>
</span>
I deployed the project to a .Net Server 2003 running the 1.1 Framework
and the code stopped working because the "input" control no longer
renders inside a "span" tag!!! It's now:
<input id="chklstItem_Item1" type="checkbox" name="chklstItem:Item1"
onclick="javascript:return MyFunction(this);" />
...so "firstChild" is redundant. I've seen posts on the annoying
"input inside a span tag" problem but I've never seen anything that
said MS fixed in in 1.1.
Anyone seen the docs on this? Or is it due to me using a 1.0 project
in a 1.1 environment perhaps?
Thanks,
John