Forum Moderators: open
function showHideCalendar() {
//The location we are loading the page into.
var objID = "calendar";
//Change the current image of the minus or plus.
if (showCalendar == true){
//Show the calendar.
document.getElementById("opencloseimg").src = "images/mins.gif";
//The page we are loading.
var serverPage = "calendar.php";
anyway, the program won't go, and I get a message that "document.getElementById" is not a function. Who said it was, anyway? Why are the interpeter and I confused?
Thanks
<div id="taskbox" class="taskboxclass"></div>
<p><a href="javascript://" onclick="showHideCalendar()"><img id="opencloseimg" src="images/plus.gif" alt="" title="" style=" border: none; width: 9px; height: 9px;" /></a>
<a href="javascript://" onclick="showHideCalendar()">My Calendar</a>
</p>
<div id="calendar" style=" width : 105px; text-align : left;"></div>
The way the book has it looks Ok to me, when one of these links is clicked the function showHideCalendar will be called onclick="showHideCalendar()"
Does your code differ from the book, and does the error occur before or after clicking on the link ?