I'm having problem with the homepage calendar.

Here is an link - http://clontarf.girlsacademy.com.au/

What I what to do is - When the user clicks the date on the calendar, the page will go to the events page (go to news/events tab, scroll down to see the heading called "Events" under the test).

Below javascript pointing to the wrong link. How can I fix the javascript so it points to the correct link?

function showEvents(date) {
rtn = "";
for (var i = 1; i < events.length; i++)
if(1900+date.getYear()==events[i][2] && 1+date.getMonth()==events[i][3] && date.getDate()==events[i][4])
rtn += events[i][1]+", \r\n";
if(rtn == "") return [false, "", ""];
return [true, '',rtn];
}

function callEvent(dateText, inst) {
dateText2 = dateText.split("/"); dateText2 = dateText2[2]+"-"+dateText2[0]+"-"+dateText2[1];
document.location.href="Event-OnDate-"+dateText2+".html";
}

$( "#datepicker" ).datepicker({
beforeShowDay: showEvents,
onSelect: callEvent
});

Any help would be appreciated?

Cheers
Paul

Line 12 of your code.

document.location.href="Event-OnDate-"+dateText2+".html";

You could put in front of it what ever the correct url is.

Example:

document.location.href="news/Event-OnDate-"+dateText2+".html";

I couldn't tell the exact change because I am still not sure where you are trying to get it to go.

Hey pixelsoul,

I'm trying to make a point to http://www.girlsacademy.com.au/news1.php?id=Event-Test-59

Example:

document.location.href="Event-OnDate-"+dateText2+".html";

change to

document.location.href="news1.php?=id="+ $(inst).attr('title').match(/\d+$/);

Is there anything wrong with this script?

The only thing I can see that looks to be a problem is the "=" after the beginning of the query string.

document.location.href="news1.php?id="+ $(inst).attr('title').match(/\d+$/);

Is there any other way to fix the error? Maybe change "=" to "-"??

What error are you getting? You didn't mention any error before.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.