I have a custom item html form that I need to automatically submit after a given duration. I've successfully written a javascript that submits the form based on the duration time specified in the medialab duration variable, but I also want to alert the user that their time is up before the submission occurs so that the item doesn't seem to randomly change.

The code for the alert box and submit function works fine by itself, but when I run it through ML, only the submit timer works, the alert box is nowhere to be seen.

Here is my code:

Code:
<script>
function alert_and_submit()
{
  alert("Out of time. Please hit OK");
  document.creativityform.submit()
}
setTimeout("alert_and_submit()", <ml.d>000);

</script>