/    Sign up×
Community /Pin to ProfileBookmark

object doesn’t support this property or method

Hi there,

I write out a page and with one external js, the function are performing but i found that i facing this error message in my IE7, “object doesn’t support this property or method”, my page are like below:

[QUOTE]

<html>
<script type=”text/javascript” src=”../Include/homePage.js”>

</script>

<body onLoad=”displayCurrentMonth()”>
<table width=”360″ border=”1″>
<tr>
<td colspan=”3″ align=”center”>

<input name=”btnPrevious” type=”button” id=”btnPrevious” value=”&lt;&lt;” onClick=”previousMonth()”>
<strong>Monthly Seat Availability</strong>
<input name=”btnNext” type=”button” id=”btnNext” value=”&gt;&gt;” onClick=”nextMonth()”></td>

</tr>
<tr>
<td colspan=”3″ align=”center”><label></label><div id=”MonthYears”></div>
<input type=”hidden” name=”hiddenMonth” id=”hiddenMonth” name=”hiddenMonth” value=””>
<input type=”hidden” name=”hiddenYears” id=”hiddenYears” name=”hiddenYears” value=””></td>
</tr>
<tr>
<td width=”180″ colspan=”1″>&nbsp;</td>
<td width=”180″>&nbsp;</td>
</tr>
</table>

</body>
</html>

[/QUOTE]

and my js is like below:

[QUOTE]

// JavaScript Document

function displayCurrentMonth()
{
var d=new Date();

var y=new Date();

var month=new Array(12)
month[0]=”January”
month[1]=”February”
month[2]=”March”
month[3]=”April”
month[4]=”May”
month[5]=”June”
month[6]=”July”
month[7]=”August”
month[8]=”September”
month[9]=”October”
month[10]=”November”
month[11]=”December”

correctMonth = month[d.getMonth()];
correctM = d.getMonth();
correctYears = y.getFullYear();
correctY = parseInt(y.getFullYear());
combineDate = correctMonth + “-” + correctYears;

document.getElementById(“MonthYears”).innerHTML= combineDate;
document.getElementById(“hiddenMonth”).value = correctM;
document.getElementById(“hiddenYears”).value = correctY;
//document.write(“The years is” + y);

}

function previousMonth()
{
var month=new Array(12)
month[0]=”January”
month[1]=”February”
month[2]=”March”
month[3]=”April”
month[4]=”May”
month[5]=”June”
month[6]=”July”
month[7]=”August”
month[8]=”September”
month[9]=”October”
month[10]=”November”
month[11]=”December”

var nowMonth = parseInt(document.getElementById(“hiddenMonth”).value);
var nowYears = parseInt(document.getElementById(“hiddenYears”).value);

if(month[nowMonth] == month[0])
{
var nowMonth = 11;
var nextMonth = month[nowMonth];
var nextYears = nowYears-1;
var hiddenNowM = nowMonth;
var hiddenNowY = nextYears;
var nextCombined = nextMonth + “-” + nextYears;

document.getElementById(“MonthYears”).innerHTML = nextCombined;
document.getElementById(“hiddenMonth”).value = hiddenNowM;
document.getElementById(“hiddenYears”).value = hiddenNowY;

}
else
{
var nextMonth = month[nowMonth – 1];
var nextYears = nowYears;
var hiddenNowM = nowMonth – 1;
var hiddenNowY = nextYears;
var nextCombined = nextMonth + “-” + nextYears;

document.getElementById(“MonthYears”).innerHTML = nextCombined;
document.getElementById(“hiddenMonth”).value = hiddenNowM;
document.getElementBtId(“hiddenYears”).value = hiddenNowY;
}

}

function nextMonth()
{
var month=new Array(12)
month[0]=”January”
month[1]=”February”
month[2]=”March”
month[3]=”April”
month[4]=”May”
month[5]=”June”
month[6]=”July”
month[7]=”August”
month[8]=”September”
month[9]=”October”
month[10]=”November”
month[11]=”December”

var nowMonth = parseInt(document.getElementById(“hiddenMonth”).value);
var nowYears = parseInt(document.getElementById(“hiddenYears”).value);

if(month[nowMonth] == month[11])
{
var nowMonth = 0;
var nextMonth = month[nowMonth];
var nextYears = nowYears+1;
var hiddenNowM = nowMonth;
var hiddenNowY = nextYears;
var nextCombined = nextMonth + “-” + nextYears;

document.getElementById(“MonthYears”).innerHTML = nextCombined;
document.getElementById(“hiddenMonth”).value = hiddenNowM;
document.getElementById(“hiddenYears”).value = hiddenNowY;

}
else
{
var nextMonth = month[nowMonth + 1];
var nextYears = nowYears;
var hiddenNowM = nowMonth + 1;
var hiddenNowY = nextYears;
var nextCombined = nextMonth + “-” + nextYears;

document.getElementById(“MonthYears”).innerHTML = nextCombined;
document.getElementById(“hiddenMonth”).value = hiddenNowM;
document.getElementBtId(“hiddenYears”).value = hiddenNowY;
}

}

[/QUOTE]

The function is wok well as what i want, but i dun know why such error will appear, anyone have idea?

Thanks and best regard
Kc

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@Mr_MooAug 30.2007 — You have the following 3 times in your code:

document.getElement[COLOR="Red"]Bt[/COLOR]Id("hiddenYears").value = hiddenNowY;
Copy linkTweet thisAlerts:
@kcwong13authorAug 31.2007 — Mr Hoo,

Thanks man, i thk i blur enough for keep coding, do such mistake.

Thanks and best regard

Kc
×

Success!

Help @kcwong13 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.25,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...