<script type="text/javascript">
var statustext="test";
$zack(function() {
$zack.setOnStatus(changelable);
});
function changelable(status) {
if (status=='A')
statustext="OK";
else if (status=='B')
statustext="Ready";
else if (status=='C')
statustext="Go";
document.getElementById('title').innerHTML = statustext; // OK, Ready or Go
}
</script>
document.getElementById('title').innerHTML shows OK, Ready or Go.
But when I use this script somewhere below the above script the statustext variable contains test text as pre assigned:
<script type="text/javascript">
document.getElementById('title2').innerHTML = statustext; // test
</script>
I want to use statustext with OK, Ready or Go text multiple times. How to do this?