Services | Updates | Contact
Home | Ajax | BioInformatics | Dojo | EAI | EJB | Hibernate | J2ME | Java | Java Glossary | Java Servlets | JavaScript | Jboss | JDBC | JDO | Jmeter | JSF | JSP | JUnit | Maven | MySQL | Spring Framework | SQL | Struts | Technology | WAP | Web Services | XML
Search All Tutorials
Top Search: Loan Struts Open Source
The Distribution Release of VLOS 1.2.1
The developers of VLOS (formerly Vidalinux Desktop OS) have released an updated version of their user-friendly distribut
 
JSF subview Tag
This tag is used to create the sub-view of the view. It contains all JSF tags in a page that is included in another JSP
 
More Tutorials...

Programming Tutorials: Ajax | Articles | JSP | Bioinformatics | Database | Free Books | Hibernate | J2EE | J2ME | Java | JavaScript | JDBC | JMS | Linux | MS Technology | PHP | RMI | Web-Services | Servlets | Struts | UML

 
 
Dojo
Comments
 
 

 

Dojo Menu and Menu Item

                           

In this section, you will learn about the menu and how to create it in dojo.

Try Online: Menu and Menu Item

Menu : This is the widget models a context menu, otherwise known as a right-click or popup menu, and it appears in a ComboButton and DropDownButton widgets. If you click on the right button of the mouse then popup menu is appeared on the screen.

MenuItem widgets are an actual items in the menu. The PopupMenuItem is a MenuItem, but it displays a submenu or other widget to the right . A PopupMenuItems always have two child nodes: a tag with the displayed label (Using SPAN tag), and a widget to be popped up, typically a dijit.Menu widget.

 

 

Here is code of program:

<html>
<head>
<title>Menu Demo</title>
    <style type="text/css">
      @import "../resources/dojo.css";
      @import "../dijit/themes/tundra/tundra.css";
      
  </style>
    <script type="text/javascript" src="dojo.xd.js" 
   djConfig="parseOnLoad: true"></script>

  <script type="text/javascript">
       dojo.require("dojo.parser");
     dojo.require("dijit.form.Button");
       dojo.require("dijit.Menu");
     function call_function(choice) {
              alert(choice+" was clicked.");
        }
    function save_function() {
              alert("Save Button");
        }
        function save_as_function(choice) {
             alert("Save As Button");
        }
     </script>
</head>
<body class="tundra">
<b>Creating DropDownButtons</b><br>
<div dojoType="dijit.form.ComboButton" onclick="save_function">
    <span>File</span>
            <div dojoType="dijit.Menu" id="saveMenu" 
   toggle="fade" style="display: none;">
                <div dojoType="dijit.MenuItem"
                     iconClass="dijitEditorIcon dijitEditorIconSave" 
    onclick="save_function">
                    Save
                </div>
                <div dojoType="dijit.MenuItem" onclick="save_as_function">
                    Save As
                </div>
            </div>
        </div>
<div dojoType="dijit.form.DropDownButton">
            <span>Edit</span>
            <div dojoType="dijit.Menu" id="Edit">
                <div dojoType="dijit.MenuItem" label="Copy"
                        onclick="call_function('copy');"></div>
                <div dojoType="dijit.MenuItem" label="Cut" 
                        onclick="call_function('cut');"></div>
                <div dojoType="dijit.MenuItem" label="Paste"
                        onclick="call_function('paste');"></div>
            </div>
        </div>

  
<br><br><br><br><br><br>  
<h1>Submenu</h1>
        <style>
        .myIcon {
           background-image:
              url
(
http://o.aolcdn.com/dojo/1.0.0/dijit/themes/tundra/images/checkmark.gif);
           background-position: -16px 0px;
           width: 16px;
           height: 16px;
        }
        </style>
       
        <div dojoType="dijit.Menu" id="submenu1"
                 contextMenuForWindow="true">
                <div dojoType="dijit.MenuItem" iconClass="myIcon"
                     onClick="alert('Hello world');">Enabled Item</div>
                <div dojoType="dijit.PopupMenuItem" id="submenu2">
                    <span>Submenu</span>
                    <div dojoType="dijit.Menu">
                                <div dojoType="dijit.MenuItem"
                                     onClick="alert('Submenu 1!')">
Submenu Item One</div>

                                <div dojoType="dijit.MenuItem"
                                     onClick="alert('Submenu 2!')">
Submenu Item Two</div>

                    </div>
                </div>
        </div>
</body>
</html>

Here is code of program:

Submenu:

 

 

                          

Facing Programming Problem?
Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 

Current Comments

0 comments so far (post your own) View All Comments Latest 10 Comments:

Leave your comment:

Name:

Email:

URL:

Title:

Comments:


Enter Code:

 

Note: Emails will not be visible or used in any way, and are not required. Please keep comments relevant. Any content deemed inappropriate or offensive may be edited and/or deleted.

No HTML code is allowed. Line breaks will be converted automatically. URLs will be auto-linked. Please use BBCode to format your text.

  EAI Articles
  Java Certification
Tell A Friend
Your Friend Name
Search Tutorials

 

 
 
Browse all Java Tutorials
Java JSP Struts Servlets Hibernate XML
Ajax JDBC EJB MySQL JavaScript JSF
Maven2 Tutorial JEE5 Tutorial Java Threading Tutorial Photoshop Tutorials Linux Technology
Technology Revolutions Eclipse Spring Tutorial Bioinformatics Tutorials Tools SQL
 

Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs

About Us | Advertising On RoseIndia.net  | Site Map

India News

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2007. All rights reserved.