Muhammad_Bilal Posted November 11, 2013 Share Posted November 11, 2013 Hello friends,I would like to ask to you that, i'm follow the dojo menubar and copy their code.I want to gives the link for these menus.first two are work fine but the problem is that the dropdown menu links doesn't work even when click on them.below is my code. <!DOCTYPE html><html><head> <meta charset="utf-8"> <title>Demo: Dijit Menus</title> <link rel="stylesheet" href="../../../resources/style/demo.css" media="screen"> <link rel="stylesheet" href="//ajax.googleapis.com/ajax/libs/dojo/1.7.5/dijit/themes/claro/claro.css" media="screen"><style>#mainMenu {background:url('../images/nav_bg.png') repeat;color:white;text-align:center;}#mainMenu:hover, #mainMenu:focus{background-color:dodgerblue;color:white;}</style></head><body> <h3>MenuBar Demo</h3> <div id="mainMenu" data-dojo-type="dijit.MenuBar"> <div id="home" data-dojo-type="dijit.MenuBarItem" onclick = "window.location.href = 'http://patf.pk'" > Home </div> <div id="tutorials" data-dojo-type="dijit.MenuBarItem" onclick = "window.location.href = 'http://patf.pk/tutorials.php'" > Tutorials </div> <div id="task" data-dojo-type="dijit.PopupMenuBarItem"> <span>Task</span> <div id="taskMenu" data-dojo-type="dijit.DropDownMenu"> <div id="complete" data-dojo-type="dijit.MenuItem"> Mark as Complete </div> <div id="cancel" data-dojo-type="dijit.MenuItem"> Cancel </div> <div id="begin" data-dojo-type="dijit.MenuItem" onclick = "window.location.href = 'http://bilalspoint.net46.net'" > Begin </div> </div> </div><!-- end of sub-menu --> </div> <p>Last selected: <span id="lastSelected">none</span></p> <!-- load dojo and provide config via data attribute --> <script src="//ajax.googleapis.com/ajax/libs/dojo/1.7.5/dojo/dojo.js" data-dojo-config="isDebug:1, async:1"></script> <script> require([ "dijit/registry", "dojo/parser", "dojo/_base/Deferred", "dojo/dom", "dijit/WidgetSet", "dijit/Menu", "dijit/MenuItem", "dijit/MenuBar", "dijit/MenuBarItem", "dijit/PopupMenuBarItem", "dojo/domReady!" ], function(registry, parser, Deferred, dom){ // a menu item selection handler var onItemSelect = function(evt){ // retrieve the widget representing the item clicked var item = registry.getEnclosingWidget(evt.target); dom.byId("lastSelected").innerHTML = item.get("label"); }; Deferred.when(parser.parse(), function(){ registry.byClass("dijit.MenuItem").forEach(function(item){ // provide an implementation for the onClick method item.onClick = onItemSelect; }); }); }); </script></body></html> as you look at the code the begin is the child of task popup menu. but it doesn't works. i'll given the begin dropdown menu link of my page but it doesn't open.please help me to go right. or if you would like to ask more let me know!any help appreciated.thanks!!! Link to comment Share on other sites More sharing options...
justsomeguy Posted November 11, 2013 Share Posted November 11, 2013 If you mean that the onclick handler doesn't fire to go to the other page, then maybe Dojo is overwriting that handler with its own click handler. Instead of an onclick handler on a div why not just put a regular link inside the div? 1 Link to comment Share on other sites More sharing options...
Muhammad_Bilal Posted November 12, 2013 Author Share Posted November 12, 2013 justsomeguy Thanks for your reply,I'll use the link in the begin dropdown div instead using the onclick handler before posting this issue and also use the other comman techniques but doesn't work for me.As you say dojo over-write their own onclick handler that's right.But i couldn't know, how to remove it and write my own onclick handler?Please help me in this issue.Thanks once again. Link to comment Share on other sites More sharing options...
justsomeguy Posted November 12, 2013 Share Posted November 12, 2013 If Dojo is overwriting the click handler then you can't fix that by changing your code, you need to change Dojo to add a click handler instead of replace what's there. I don't know if that's what Dojo is actually doing, but it's a possibility. 1 Link to comment Share on other sites More sharing options...
Muhammad_Bilal Posted November 13, 2013 Author Share Posted November 13, 2013 thanks once again for your reply, would here any one who tell me how to use the dojo click handler to open the requested site. any reply appreciated. Link to comment Share on other sites More sharing options...
Muhammad_Bilal Posted November 13, 2013 Author Share Posted November 13, 2013 Hi Guys! i'll find the solution for myself. last time thanks for suggestions and reply. If you also want to learn how to do this just reply on this topic i'll tell you seriously. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now