@T.J. and Trevan:

Thank you for the help, now I managed to use it.

Still a long way to learn javascript :)

On 3月22日, 下午6时07分, "T.J. Crowder" <[email protected]> wrote:
> @Trevan:
>
> Well spotted!  Except:
>
> > window.observe('dom:loaded', function() {new Control.DatePicker(...)});
>
> It's document.observe[1], not window.observe.  (Or you can use
> window's onload event, but that waits until after all images load.)
>
> @OP:
>
> You can't rely on looking up IDs until the document is complete; see
> document.observe[1] for more on the dom:loaded event.
>
> [1]http://prototypejs.org/api/document/observe
>
> HTH,
> --
> T.J. Crowder
> tj / crowder software / com
> Independent Software Engineer, consulting services available
>
> On Mar 22, 8:15 pm, Trevan Richins <[email protected]> wrote:
>
> > On 3/22/2009 2:08 PM, !oEL wrote:
>
> > > First of all, thank you for your time to moderate my first post.
>
> > > Here is the complete (yet minimal) code snippet which indicates all
> > > the dependencies (I've downloaded from prototype official site and the
> > > authoer's site:http://home.jongsma.org/software/js/datepicker):
>
> > > -- code start --
>
> > > <html>
> > > <head>
> > > <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
> > > <title>Calendar Example</title>
>
> > > <script src="js/lib/prototype.js" type="text/javascript"></script>
> > > <script src="js/lib/prototype-base-extensions.js" type="text/
> > > javascript"></script>
> > > <script src="js/lib/prototype-date-extensions.js" type="text/
> > > javascript"></script>
> > > <script src="js/src/scriptaculous.js" type="text/javascript"></script>
> > > <script src="js/controls/datepicker.js" type="text/javascript"></
> > > script>
>
> > > <link rel="stylesheet" rev="stylesheet" href="style/datepicker.css"
> > > type="text/css" media="all" />
>
> > > <script type="text/javascript">
> > > new Control.DatePicker('my_datepicker', {icon: 'style/calendar.png'});
> > > </script>
> > > </head>
>
> > > <body>
> > > <input type="text" id="my_datepicker" />
> > > </body>
>
> > > -- code end --
>
> > The input hasn't been created by the time the javascript is called.  You
> > either need to move the code:
>
> > new Control.DatePicker(....)
>
> > to below the <input> or wrap it in a function that gets called at page
> > load.  Something like this:
>
> > window.observe('dom:loaded', function() {new Control.DatePicker(...)});
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to