Thursday, 15 July 2010

javascript - Is there a way to auto check an input box when it's created? -



javascript - Is there a way to auto check an input box when it's created? -

i'm maintaining old asp classic site auto generates rows in table. when input box row generated, it's given auto generated name. don't won't know id/name before hand.

if throw next code in onmouseover event, works. can't figure out how code run when input command created.

document.getelementsbyname(this.name)[0].checked = true;

this whole row looks like:

<td class="tabledatacell" valign="top" nowrap> <input disabled class="mccheckbox" onloadstart="document.getelementsbyname(this.name)[0].checked = true;" mctype="b" mcrequired="n" type="checkbox" value="on" name="txtal1autoassignrow_id"> </td>

i tried events onload , onloadstart, won't fire. when it's alert.

you html this: (add checked attribute)

<td class="tabledatacell" valign="top" nowrap> <input disabled class="mccheckbox" mctype="b" mcrequired="n" type="checkbox" value="on" name="txtal1autoassignrow_id" checked> </td>

javascript html asp-classic

No comments:

Post a Comment