Milonic provide full featured pull down web menus for some of the worlds largest companies
click here to see what it can do for you

Download Milonic DHTML Menu
Buy Milonic DHTML Menu

Back To Start Of Archive
Taken From The Forum: Help & Support for DHTML Menu Version 5+
Forum Topic: Click to view post
Last Updated: Saturday July 14 2012 - 06:07:15

onclick="return confirm()

Poster: kgp43
Dated: Saturday August 14 2004 - 21:02:05 BST


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>


Poster: kevin3442
Dated: Sunday August 15 2004 - 3:54:40 BST


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:
function logout()
  if (confirm('Are you sure you want to logout?'))
    location.href = "";

Then code the Logout menu item like this:

That should do it.



Poster: kgp43
Dated: Sunday August 15 2004 - 10:01:12 BST

I added it all to menu_data.js, isnt that correct?
It dosent seems to work (it just logout without the popup/confirm)

Poster: kevin3442
Dated: Sunday August 15 2004 - 10:20:27 BST

Can you post a url to the site, so I can take a look? If not, can you post the code from your menu_data.js file here? If you post code, please put all of it between BBCode "code" tags, like so

your code goes here



Poster: kgp43
Dated: Sunday August 15 2004 - 10:40:02 BST

It is working now (uploaded the wrong file)
Thanks for the help :)