I have an overly simple javascript function and I can't figure out why the if statement isn't triggering in it:
var theChange;
function showChangeBox(theChange) {
if (theChange == 'fName') {
document.getElementById('userPanelChangeBox').innerHTML = 'Some HTML';
}
document.getElementById('userPanelChangeBox').style.display = "block";
return;
}
It's called by an onClick:
<a href="#" onclick="showChangeBox('fname');">Click to Change</a>
Simple, right? I've done a bunch of these before, I can't figure out why this isn't working, I'm sure it's something ridiculous that I missed but after staring at it for 20 minutes, my tunnel vision might be preventing me from seeing the error.
It's开发者_如何学JAVA triggering the change to the display, but I know it isn't going to the if because if I put an alert in it, I get no alert. Grrr. Thanks for the help.
It's a matter of case, "fName"
!= "fname"
.
精彩评论