J
Jake Barnes
Imagine I have these two lines of HTML:
<p>Pick a list: (<a href="mcControlPanel.php"
onClick="hideOrShowDivById('newMailList'); return false;">Create New
List?</a>)</p>
<form id="newMailList" method="post" action="mcControlPanel.php">
Imagine I have this function:
function hideOrShowDivById(optionDivId) {
if (document.getElementById(optionDivId)) {
var optionDiv = document.getElementById(optionDivId);
if (optionDiv.style.display == 'block') {
optionDiv.style.display='none';
} else {
optionDiv.style.display='block';
}
} else {
alert("There was no item on the page called " + optionDivId);
}
}
Why would I get the error message ""There was no item on the page
called newMailList"
<p>Pick a list: (<a href="mcControlPanel.php"
onClick="hideOrShowDivById('newMailList'); return false;">Create New
List?</a>)</p>
<form id="newMailList" method="post" action="mcControlPanel.php">
Imagine I have this function:
function hideOrShowDivById(optionDivId) {
if (document.getElementById(optionDivId)) {
var optionDiv = document.getElementById(optionDivId);
if (optionDiv.style.display == 'block') {
optionDiv.style.display='none';
} else {
optionDiv.style.display='block';
}
} else {
alert("There was no item on the page called " + optionDivId);
}
}
Why would I get the error message ""There was no item on the page
called newMailList"