I’m trying to pass a value and span id to a JavaScript function. I think I have the value set right but I’m having problems passing the span.
This is a nested gridview so I can’t see the control and need to send it to the function.
In GridView
<input type="button" onclick='<%# Eval("FormulaTiming", "countdown({0}); Eval("TimeMinutes.ClientID")%>' value="Start" id="Start" />
<input type="button" value="Stop" id="Stop" />
<input type="text" value='<%#Eval("FormulaTiming")%>' id="TimeMinutes" />
<span id="CountDown"></span>
JavaScript Function
var interval;
function countdown(minutes, spanid) {
interval = setInterval(function () {
var lbl = document.getElementById(element);
if (seconds == 0) {
if (minutes == 0) {
el.innerHTML = "countdown's over!";
clearInterval(interval);
return;
} else {
minutes--;
seconds = 60;
}
}
if (minutes > 0) {
var minute_text = minutes + (minutes > 1 ? ' minutes' : ' minute');
} else {
var minute_text = '';
}
var second_text = seconds > 1 ? 'seconds' : 'second';
el.innerHTML = minute_text + ' ' + seconds + ' ' + second_text + ' remaining';
seconds--;
}, 1000);
}
I am still trying to figure out how to change the script, but first I need to pass the eval and span.
Thanks for your help
The following asp.net code
Should yield the following HTML