Re: Menu remains highlighted after alert
2005/10/11 01:09
Viewed 7176 times
Replies: 1/1

There is a problem indeed with your approach.  The menu closes right after evaluating the JavaScript expression, but an “alert” dialog is modal (it stops the JS threads until the end user clicked on OK).

We hope to be able to make this easier in next versions, but for now here is a quick workaround:

<script type="text/javascript">
function displayAlert(message) {
setTimeout("alert('" + message + "')", 10);
}
</script>

[ ... ]

<ul id="menu">
[ ... ]
<li><a href="javascript:displayAlert('About us...')">About us</a></li>
</ul>

So as you can see, the idea is to delay the displaying of the alert by a short time (10 milliseconds).  During that time, the browser will get a chance to run the code that closes the menu.

I hope this helps.

Re[2]: Menu remains highlighted after alert
2005/10/11 13:00
Viewed 8810 times
Replies: 0/0

You guys game through again. That worked. Thanks!

last
Google