/    Sign up×
Community /Pin to ProfileBookmark

Please help debug

I wrote a simple code that should display a hidden element if one of the check boxes is checked and hide it back when all checkboxes are un-checked. I keep getting errors and have no idea why… Here’s my code:

[code=php]
<html>
<head>
<script language=”JavaScript”>
<!–
function unCheckRadio(oRadio) {
var or = document.getElementsByName(oRadio);
for (var i = 0; i < or.length; i++) {
or[i].checked = false;
}
}

function toggleOther() {
if(document.getElementByID(“tlntSpot_other”).checked) {
document.getElementById(“otherTlnt”).style.display = “block”;
} else {
document.getElementById(“otherTlnt”).style.display = “none”;
}
}
//–>
</script>
</head>

<body onLoad=”toggleOther();”>

<form>
<table>
<tr>
<td><input type=”radio” name=”tlntSpot_other” id=”tlntSpot_other”value=”10″ onClick=”toggleOther();”>10</td>
<td><input type=”radio” name=”tlntSpot_other” id=”tlntSpot_other”value=”15″ onClick=”toggleOther();”>15</td>
<td><input type=”radio” name=”tlntSpot_other” id=”tlntSpot_other”value=”25″ onClick=”toggleOther();”>25</td>
<td><a href=”javascript:unCheckRadio(‘tlntSpot_other’); toggleOther();”>un-check</a></td>
</tr>

<tr id=”otherTlnt”>
<td colspan=4>
Hidden content here…
</td>
</tr>
</table>
</form>

</body>
</html>

[/code]

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@chazzyJan 11.2009 — function names are case sensitive. document.getElementByID is not the same as document.getElementById

you should consider downloading the web developer and firebug extensions for firefox, if you use that browser. they will aid you in debugging simple errors like this.
×

Success!

Help @santa 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.15,
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: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

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