Hello,
How do I add this "onClick confirm" to the menu?
<a href="logout.php" onclick="return confirm('Are you sure you want to logout?');">Logout</a>
aI("text=Logout;url=http://www.tackleprices.com/merchant/logout.php;");
onclick="return confirm()
Hi,
Hmmm... the url parameter is likely to be used regardless of what you run with the clickfunction item property, and you'd end up going to the logout page regardless of the result of the confirm. Might be better to wrap the whole thing in a function that changes the page's location conditionally, depending on the return from the confirm(). Try it like this... put the following function at the top of your menu_data.js file:
Then code the Logout menu item like this:
That should do it.
Cheers,
Kevin
Hmmm... the url parameter is likely to be used regardless of what you run with the clickfunction item property, and you'd end up going to the logout page regardless of the result of the confirm. Might be better to wrap the whole thing in a function that changes the page's location conditionally, depending on the return from the confirm(). Try it like this... put the following function at the top of your menu_data.js file:
Code: Select all
function logout()
{
if (confirm('Are you sure you want to logout?'))
location.href="http://websites.milonic.com/tackleprices.com/merchant/logout.php";
}
Code: Select all
aI("text=Logout;url=javascript:logout();");
Cheers,
Kevin