In my MS SQL table, I read in an "time_zone" for a city from a record.
I then want to use this time zone in a Javascript function to create a digital clock for that city.
Currently I am trying to set the time_zone variable from
Here's a code snippet from Default.aspx:
function showtime() {
zone(hiddenZone,clock);
}
window.onload = showtime;
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<span id="clock"></span>
<asp:HiddenField ID="hiddenZone" runat="server" />
<asp:Label Text="" ID="lblXml" runat="server"></asp:Label>
</div>
</form>
</body>
</html>
The only C# I have in my Default.aspx.cs for is:
hiddenZone.Value=timeZone;
I've checked and timeZone has the correct value read in from the database.
The error message I receive from the JS in the "showtime" function is: "hiddenZone is undefined"
How can I get the "timeZone" C# variable into my Javascript and use it for the function?