0

Hey I tried to use Any+Time date picker, written in java script with the tutorial offered at its download website (http://www.ama3.com/anytime/) but somehow can't get it to work. Right now, it displays nothing more than plain text box. Can someone tell me what am I doing wrong after looking at the html page below?

<html>
<head>
<title>My page</title>
<link rel="stylesheet" type="text/css" href="/anytime.css" />
<script type="text/javascript" src="/jquery-1.4.2.min"></script>
<script type="text/javascript" src="/anytime.js"></script>
</head>
<body>
<style type="text/css">
  #field2 { background-image:url("clock.jpg");
    background-position:right center; background-repeat:no-repeat;
    border:1px solid #FFC030;color:#3090C0;font-weight:bold}
  #AnyTime--field2 {background-color:#EFEFEF;border:1px solid #CCC}
  #AnyTime--field2 * {font-weight:bold}
  #AnyTime--field2 .AnyTime-btn {background-color:#F9F9FC;
    border:1px solid #CCC;color:#3090C0}
  #AnyTime--field2 .AnyTime-cur-btn {background-color:#FCF9F6;
      border:1px solid #FFC030;color:#FFC030}
  #AnyTime--field2 .AnyTime-focus-btn {border-style:dotted}
  #AnyTime--field2 .AnyTime-lbl {color:black}
  #AnyTime--field2 .AnyTime-hdr {background-color:#FFC030;color:white}
</style>
<div id="content"><h1>Any time</h1><br /><br/>
Date: <input type="text" id="field1" size="50"
    value="Sunday, March 13th in the Year 2011 CE" /><br/>
Time: <input type="text" id="field2" value="12:34" />
<script type="text/javascript">
  $("#field1").AnyTime_picker( { format: "%W, %M %D in the Year %z %E", firstDOW: 1 } );
  $("#field2").AnyTime_picker( { format: "%H:%i", labelTitle: "Hour", labelHour: "Hour", labelMinute: "Minute" } );
</script>
</div>
</body>
</html>
Logan H
  • 3,383
  • 2
  • 33
  • 50
SerotoninChase
  • 424
  • 11
  • 28
  • have you tried putting your initialization in a document.ready? – Mike Robinson Mar 14 '11 at 03:29
  • is the .js accessible? Is it in the correct location? – clyc Mar 14 '11 at 03:29
  • The .js is accessible. I know this because when you initially run the code after downloading it there's this alert function that pops up. This alert message is at the end of the line in anytime.js. I would appreciate if someone tested it out. You can take the html code I pasted above. The download from the website takes a second. – SerotoninChase Mar 14 '11 at 05:08

3 Answers3

0

Try this:

$(document).ready(function(){
 $("#field1").AnyTime_picker( { format: "%W, %M %D in the Year %z %E", firstDOW: 1 } );
  $("#field2").AnyTime_picker( { format: "%H:%i", labelTitle: "Hour", labelHour: "Hour", labelMinute: "Minute" } );
});
Conner
  • 30,144
  • 8
  • 52
  • 73
0

You're missing .js after /jquery-1.4.2.min in your script tag trying to load jQuery.

Andrew M. Andrews III
  • 1,989
  • 18
  • 23
0

I'm really not sure if it was a mistake on my part or whether the jquery file I downloaded from the Any + Time Date picker website had a problem. After I downloaded jquery from the official jquery website everything works fine.

So Andrew M. Andrews III, can you check if the jquery-1.4.2.min.js downloadable at your website still works fine? I may be wrong but its worth testing it out.

Thanks everyone for your time in helping me out.

Regards, SerotoninChase

SerotoninChase
  • 424
  • 11
  • 28
  • The jquery-1.4.min.js link on my site is actually to the code on jquery.com. Perhaps something went wrong with your download and the file was corrupted?In any case, I'm glad you got it to work. Please contact me via the link on my website if you have further questions, problems or suggestions! – Andrew M. Andrews III Mar 15 '11 at 19:08