Hi,
I have a row of buttons that are made by innerhtml using this code:
Code:
sidebar_html += '<div id="button"><input type="button" onclick="toggleRun('+poly_num+')" value="Start Bus" id="runBtn'+poly_num+'" style="width:120px; height:24px; text-align:center"></div><br />';
to fire this function:
Code:
function toggleRun(poly_num){
var btn = document.getElementById('runBtn'+poly_num);
if (document.getElementById('runBtn'+poly_num).onclick) {
if (run){
run=false;
document.getElementById('runBtn'+poly_num).value="Reload Page";
startAnimation(poly_num);
} else {
run=true;
document.getElementById('runBtn'+poly_num).value="Reload Page";
window.location.reload();
}
}
}
the function can only run once, so the idea is that the button either runs it the first time or reloads the page.
at the moment, the way it's working is that the button that's clicked changes its value to "Reload Page" but the others keep their original value, even though it reloads if you click them.
So I'd like a way to change the value of the rest of the buttons when one is clicked. Is that possible?
Here's the
page if I didn't explain myself well enough.