...

View Full Version : javascript calendar won't appear unless HTML is commented out?



crmpicco
05-08-2007, 05:04 PM
<html>
<head>
<meta http-equiv="Content-Language" content="en-gb">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>PiccoNet</title>
</head>
<body>

<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td valign="top">
<div class="pageheader">
<div class="pageheaderleft">
<h1>Administration</h1>
<div id="tabs">
<ul>
<li><a href="/system/adm2.pl" title="Main Menu">Main Menu</a></li>
<li class="here"><a href="?action=findc" title="C">C</a></li>
<li><a href="?action=find" title="I">I</a></li>
<li><a href="?action=showc" title="Groups">Groups</a></li>
<li><a href="?action=special" title="Specials">Specials</a></li>
<li><a href="?action=pricec" title="Price C">Price C</a></li>
<li><a href="?action=upload" title="Image">Image</a></li>
</ul>
</div>
</div>
<!--
WORKS WHEN THIS IS OUT?!??
<div class="pageheaderright">
<form method="GET" action="/system/ch.pl">
Page #<input type="text" name="page" value="978" size="5">
<input type="submit" value="Go">
</form>
</div>
-->
</div>

<p class="bread"><img src="/images/breadarrow.gif" width="14" height="9" alt="&gt;"><a href="/system/adm2.pl">Main</a></p>

<script language="JavaScript" src="CalendarPopup.js"></script>

<script language="JavaScript">
var now = new Date();
var cal = new CalendarPopup("calendar");
cal.addDisabledDates(null, formatDate(now, "yyyy-MM-dd"));
cal.offsetX = 90;
cal.offsetY = 20;
document.write(getCalendarStyles());
</script>

<!-- for the calendar -->
<div id="calendar" style="position:absolute; visibility:hidden; background-color:white; layer-background-color:white;"></div>

<h2 style="margin-bottom: 0">Balance Calculator</h2>

<div class="formback">
<form style="margin: 0;">
<table cellspacing="2" cellpadding="2" class="formtable"><tr>
<td class="formlabel">Start Date&nbsp;<span class="formrequired">*</span></td>

<td class="formfield"><input type="text" name="date" id="date" value="dd/mm/yyyy" tabindex="3" style="width: 180px;" autocomplete="off" onclick="cal.select(document.forms[0].date,'date','dd/MM/yyyy'); return false;" onfocus="cal.select(document.forms[0].date,'date','dd/MM/yyyy'); return false;"></td>
</tr><tr>
<td class="formlabel">&nbsp;</td>
<td class="formfield"></td>
</tr>
</table>
</form>
</div>
</td>
</tr>
</table>
</body>
</html>


Any idea why, with this code the js pop-up won't appear unless the code that i have commented out is commented out?
Help appreciated.
Picco

nikkiH
05-08-2007, 07:00 PM
Well, without seeing the code, I'm guessing it is assuming something about a form.

david_kw
05-08-2007, 07:03 PM
Nothing is jumping out at me. Can you post a link to the failing version?

david_kw

crmpicco
05-09-2007, 11:47 AM
turned out it was the
document.forms[0].date call on my onclick. I used forms[0] instead of forms[1]. I know it's old school code anyway now, need to get it changed to document.getElementById.

Picco



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum