I did a little more testing on this after posting.
The solution is to add an empty Event Handler to the button to receive the click. That way i get a new slot.
Case OnButtonX_Click
EndCase
I also enhanced it a little by moving the button to the middle of the form when displaying (control.style.top ,bottom ,left ,right). That way it can be moved out-of-way in the MDE, not to disturb editing of the form.
My version of the script:
var sTimer=70
// Control id of the button used
var id = "ButtonX";
var control = document.getElementById(id);
control.value=sTimer;
display();
function display(){
var done = 0;
sTimer -= 1;
if( sTimer <= 0 )
done = 1;
if( sTimer <= 10 )
{
control.style.visibility = 'visible';
control.style.backgroundColor = "red";
control.style.top="130px";
control.style.bottom="480px";
control.style.left="300px";
control.style.right="700px";
control.value="Do you need more time? \n Click to continue";
}
else
control.value=sTimer;
if( !done )
{
setTimeout("display()",1000) ;
}
else
{
IWCTrigger("WINEXIT");
window.opener=self;
window.close();
}
}
Regards, Mats
Mats Sundelin
Cybernetics Business Solutions AB