/    Sign up×
Community /Pin to ProfileBookmark

Checkbox not getting checked for onclick event!!!

Hi,
I am trying to invoke a onClick event on a checkbox.

<form id=”Form1″ method=”post” runat=”server”>
<H4 class=”outline”>
<INPUT id=”inputChk” name=”checkName” type=”checkbox” [B]onclick[/B]=”[B]expandIt[/B](el2); return false”>
Time now for business with Collately Sisters</H4>
<DIV class=”hiddentext” id=”el1″>
<P>No let-up today for British manufacturers, there were large profit slumps for
Securivadge and United Haha. Down 6.4, Joanny Collins perhaps units on a lower
third rung. There was better news for Edgyledgywedgebarge, who mustered 2.41 up
88 very slightly [she smiles wryly for no reason], but Oxymacgee flew back a
ninth, despite a creeping bid from Connected Breathdumps at four.</P>
</DIV>
<H4 class=”outline” onclick=”expandIt(el2); return false”>Sylvester Stuart has
today’s weather</H4>
<DIV class=”hiddentext” id=”el2″>
<P>Starting in the southeast, where it’ll be misty tomorrow with a droplet density
of about 50,000 per spherical inch. That’s rather as if the mist were hugging
the ground like an over-affectionate and rather damp dog. Over to East Anglia
and the Midlands, there’ll be a warm day tomorrow, about 20, that’s the sort of
warmth you might feel on a January morning walking into a heated drawing room
after chopping some wood. And finally, into the north of England and Scotland –
a strong and highly long-lasting day tomorrow, with hail aimed down vertically
from above, and there’ll be a 30% chance. In summary then – breezes. And that’s
all the weather.
</P>
</DIV>
</form>

and this is the expandIt javascript function which is triggered on checkbox click.
<SCRIPT language=”JavaScript” type=”text/javascript”>
<!– // hide from old browsers

// hide text from MSIE browsers

with (document)
{
write(“<STYLE TYPE=’text/css’>”);
if (navigator.appName == ‘Microsoft Internet Explorer’)
{
write(“.hiddentext {display:block} .outline {cursor:hand; text-decoration:underline}”);
}
write(“</STYLE>”);
}

// show text on click for MSIE browsers

function [B]expandIt[/B](whichEl)
{
//if (navigator.appName == ‘Microsoft Internet Explorer’)
// {
whichEl.style.display = (whichEl.style.display == “block” ) ? “none” : “block”;
// }
//else return;
}
// end hiding from old browsers –>
</SCRIPT>

My problem is though the event gets fired the checkbox remains unchecked. The control’s property(disabled has been set to false). Can anybody help me regarding this,please???

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@CharlesMay 02.2005 — The [font=monospace]return false[/font] is causing this.
×

Success!

Help @Aarthi spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.4,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...