Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 05-08-2007, 05:04 PM   PM User | #1
crmpicco
Senior Coder

 
crmpicco's Avatar
 
Join Date: Jan 2005
Location: Mauchline, Scotland
Posts: 1,091
Thanks: 15
Thanked 1 Time in 1 Post
crmpicco has a little shameless behaviour in the past
Unhappy javascript calendar won't appear unless HTML is commented out?

Code:
<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
crmpicco is offline   Reply With Quote
Old 05-08-2007, 07:00 PM   PM User | #2
nikkiH
Senior Coder

 
nikkiH's Avatar
 
Join Date: Jun 2005
Location: Near Chicago, IL, USA
Posts: 1,973
Thanks: 1
Thanked 32 Times in 31 Posts
nikkiH is on a distinguished road
Well, without seeing the code, I'm guessing it is assuming something about a form.
__________________

If this post contains any code, I may or may not have tested it. It's probably just example code, so no getting knickers in a bunch over a typo, OK? If it doesn't have basic error checking in it, such as object detection or checking if objects are null before using them, put that in there. I'm giving examples, not typing up your whole app for you. You run code at your own risk.
Bored? Visit
http://www.kaelisspace.com/
nikkiH is offline   Reply With Quote
Old 05-08-2007, 07:03 PM   PM User | #3
david_kw
Senior Coder

 
Join Date: Nov 2006
Posts: 1,000
Thanks: 0
Thanked 0 Times in 0 Posts
david_kw will become famous soon enough
Nothing is jumping out at me. Can you post a link to the failing version?

david_kw
__________________

www.eXfer.net
david_kw is offline   Reply With Quote
Old 05-09-2007, 11:47 AM   PM User | #4
crmpicco
Senior Coder

 
crmpicco's Avatar
 
Join Date: Jan 2005
Location: Mauchline, Scotland
Posts: 1,091
Thanks: 15
Thanked 1 Time in 1 Post
crmpicco has a little shameless behaviour in the past
turned out it was the
Code:
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
crmpicco is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 09:02 AM.


Advertisement
Log in to turn off these ads.