Craig Hopson, on 01 December 2012 - 22:19, said:
thanks for the quick reply i tried your example but it didn't work
Whoops. Forgot to assign interval = setInterval()
<script>
var seconds = 1000;
var interval;
function test(optvalue) {
seconds = optvalue;
alert(optvalue);
window.clearInterval(interval);
interval = window.setInterval(myDateFunction, seconds);
}
var myDateFunction = function(){
var d=new Date();
document.getElementById("output").innerHTML = d;
};
interval = window.setInterval(myDateFunction, seconds);
</script>
Also keep in mind that interval is set in ms, not seconds, so you might not get what you expect with your option values.