Your calling toDate() as a method on the jQuery object, which it
isn't; it's simply a function that prints out the date (and you should
maybe rethink the document.write, it's deprecated). If you want the
output to appear as the content of the element with id 'today' then do
something like

 $("div").filter("#today").text( toDate() );

On Apr 14, 1:21 am, kiusau <kiu...@mac.com> wrote:
> I am new to jQuery, but understand enough to have already begun
> targeted experimentation.  I have run into a snag.  In brief, I am
> trying to call a function from a .JS file that contains no jQuery and
> assign it to an HTML tag in a Dreamweaver template via jQuery that is
> located in a different .JS file.  The code is as follows:
>
> JQUERY CODE
> $(document).ready(function() {
>    $("div").filter("#today").toDate();
>
> });
>
> The expression toDate() is the function that I try to call.
>
> MY DREAMWEAVER TEMPLATE (HEAD TAG)
> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/
> libs/jquery/1.3/jquery.min.js"></script>
> <script type="text/javascript" src="imagine.js"></script>
> <script type="text/javascript" src="primer.js"></script>
>
> MY DREAMWEAVER TEMPLATE (BODY TAG)
> <div id=today"></div>
>
> The FUNCTION in MY NON-JQUERY .JS FILE
> function toDate() {
> var someDay = new Date();
> var anyDay = new Array();
> var anyMonth = new Array();
>
> anyDay[0] = "Sunday";
> anyDay[1] = "Monday";
> anyDay[2] = "Tuesday";
> anyDay[3] = "Wednesday";
> anyDay[4] = "Thursday";
> anyDay[5] = "Friday";
> anyDay[6] = "Saturday";
>
> anyMonth[0] = "January";
> anyMonth[1] = "February";
> anyMonth[2] = "March";
> anyMonth[3] = "April";
> anyMonth[4] = "May";
> anyMonth[5] = "June";
> anyMonth[6] = "July";
> anyMonth[7] = "August";
> anyMonth[8] = "September";
> anyMonth[9] = "October";
> anyMonth[10] = "November";
> anyMonth[11] = "December";
>
> document.write("<p>Today's Date:<br />" + anyDay[someDay.getDay()] +
> ", " + someDay.getDate() + " " + anyMonth[someDay.getMonth()] + " " +
> someDay.getFullYear() + "</p>");
>
> }
>
> Can you find my error?  If so, can you explain what I am doing wrong
> and explain how to overcome it?
>
> Roddy Stegemann

Reply via email to