mercredi 18 février 2015

getting error when trying to change asp.net label values using JavaScript


I have an asp.net website. I want to change the label values in a JavaScript function.


Here is my code,



<td id="m1" runat"server" onclick = "createChart_Jan"></td>
<asp:Label ID="lblGeneral" runat="server" Text="" Font-Bold="true" Font-Size="Medium"></asp:Label>


JavaScript,



function createChart_Jan() {
var month = 1;
var d = new Date();
var month_current = d.getMonth() + 1;
if(month > month_current)
{
document.getElementbyId("lblGeneral").innerHTML = "0";
}
else
{
document.getElementbyId("lblGeneral").innerHTML = "500";
}
}


But I am getting "Uncaught TypeError: undefined is not a function" error when I click on td element.


Any idea on what is wrong with above code?





Aucun commentaire:

Enregistrer un commentaire