Javascript警报很快消失

This may be hard to help me with but I'm out of options and have no hair left so here goes;

I have this simple part in my program where if a check box is disabled and the user is using the site on a device like an iPad they will get an alert box popup if they touch the check box. The problem that I'm having is that it works as expected on one domain but then on another domain it just flashes very quickly then goes away.

Because I don't have a Mac computer I can't use the Safari Web Console installed to see if any errors are coming up.

Here's the code to generate the alert;

if ($device == 'TAB') {
    echo "<div id='" . preg_replace('/[^a-zA-Z0-9]/', '', $menu_name) . "OV' 
    class=\"overlay\" onClick=\"alert('My message');\"></div></div>";
} else {
    echo "</div>";
}

Any ideas of why this would work in one place and not the other and anything that I can do to try to get the iPad to give me more info to what's going on here?

Here is where it works, interactive-floor-plan dot com/ifp.php?width=633&ProductID=1

and here is where it doesn't

plangator dot com/demo/ifp.php?width=633&ProductID=1


Your code seems completely fine to me, although your echo is a little bit unclear, because it's on one line. The problem should be somewhere else on your page. Try to find out what's happening with firebug. Here's a SO post about it. iPad firebug lite or similar Both links on that page seem useful to me. Good luck!