...

View Full Version : IE9 Javascript problem



cclayton
03-07-2012, 06:58 PM
Hi All,

I am desperately pulling my hair out... can you help me understand how I can resolve the below errors:

SCRIPT1028: Expected identifier, string or number
calender.js, line 318 character 17
SCRIPT1006: Expected ')'
blenheim-palace-lunch-cotswolds-p-170.html, line 88 character 35
SCRIPT5007: The value of the property 'getStartDate' is null or undefined, not a Function object
blenheim-palace-lunch-cotswolds-p-170.html, line 643 character 7

For this web address... http://tinyurl.com/79msxqm

What can I change to fix the issue? The site is working properly in all other browsers but not IE9.

Hope you can help. Thanks.

blaze4218
03-07-2012, 07:02 PM
SCRIPT1028: Expected identifier, string or number
calender.js, line 318 character 17
selectedDate is the last in your series, and as such should not be followed by a comma
change

selectedDate:sday,
to

selectedDate:sday

cclayton
03-07-2012, 07:10 PM
Thank you for that! It has fixed the issue which is such a relief. I dont suppose you know why I am still getting the error...

SCRIPT1006: Expected ')'
blenheim-palace-lunch-cotswolds-p-170.html, line 88 character 35

Thanks again - it is much appreciated.

Logic Ali
03-07-2012, 08:34 PM
I dont suppose you know why I am still getting the error...

SCRIPT1006: Expected ')'
blenheim-palace-lunch-cotswolds-p-170.html, line 88 character 35





var today = new Date(2012,2,7 ,9:,9:,6);

That's the line to which the error refers.

blaze4218
03-07-2012, 08:42 PM
var today = new Date(2012,2,7 ,9:,5:,3);
this is not how you create a date object. Date() will accept any legitimate format (of the many I have tested) as a parameter, including a time stamp. What you have done here is split the date into 6 parameters, two of which are not valid. you can not pass 9: as a parameter, you can however pass the string "9:" as a parameter. But even that would be incorrect for the Date object. Try


var today = new Date("9:30:30 2012/2/7");

cclayton
03-08-2012, 09:32 AM
Thanks for the responses. This is dynamically populated, the actual JS that creates this is:

function getStartDate() {
var today = new Date();
var sday = new Date(today.setDate(today.getDate()+2));
//nullify hrs, mins, secs

The link to the whole JS file is here: http://tinyurl.com/6ol5j8v

Any assistance to rectifiy this would be hugely appreciated.

Thanks!

blaze4218
03-08-2012, 06:44 PM
I'm afraid the new link you have provided is irrelevant. The line
var today = new Date(2012,2,8 ,7:,4:,1); is not dynamically generated by javascript. It is very real, and very present on your HTML page. It needs to be removed, or changed.
If the line is dynamically generated on the server, then you need to fix your server code to prevent the HTML page from containing the error.

When javascript dynamically generates javascript code, the generated code is not present when the user uses "view source", only the code to generate the code is visible. And since I can see the line in question, it was not "dynamically populated"



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum