Hi guys,
When an illegal character comes up in a textfield, I have an alert pop-up telling me how stupid I am, and I’d like to automatically set the focus to the right textbox, but I don’t know how to detect the closing of the pop-up.
I’ll assume you know how to set the focus to a textfield(because I don’t :P). You can use the onunload event of body to run Javascript. Something like this:
<html>
<head>
<title>close me!</title>
<script language="JavaScript">
function traceMe(){
alert('You closed the window! How dare you...');
}
</script>
</head>
<body onunload="traceMe()">
</body>
<html>
I think Pom’s talking about from an windows alert box. You know, the ones that only have an okay button - or what some bastards are using as the ‘new popup’ advertisements.
And, no, I cant think of a way unless you have a script that repeatedly sets focus, but then you could only enter info in one field.
*Originally posted by claudio *
**Ilyas, i dunno if thats possible, and if not, you could use the window.confirm method. **
I’ll look in to that too, thanks Claudio