Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

dojo not defined help

Status
Not open for further replies.

rfreshour

Programmer
Jan 22, 2008
11
I have a simple dojo menu system .html script. I'm getting a dojo not defined error on line 15 but I've got a src line pointing to it. Can someone tell me why I'm getting this error? I have dojo installed off of my public_html folder starting with the js folder.

<html>
<head>
<title>Menu Demo</title>
<script type="text/javascript" src="../js/dojo.js"></script>
<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");
>>>>>err line 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( 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>
 
I can only assume that Dojo is not loaded. It could be that the path to the dojo js file(s) are incorrect. Try and view the files using the same url that the HTML uses (maybe switch to making it absolute, rather than relative to identify the cause in this case).

Use Firefox and Firebug extension to help debug this (specifically the "Net" tab - looking for errors in retrieving the Dojo js files).

Cheers,
Jeff

[tt]Jeff's Blog [!]@[/!] CodeRambler
[/tt]

Make sure your web page and css validates properly against the doctype you have chosen - before you attempt to debug a problem!

FAQ216-6094
 
Yep...I was missing one whole folder! Thanks.

Now the code runs without any errors (in FF3 with the err console showing).

My menu displays as text - all of the menu items instead of in a menu structure. Any idea's on why this might be doing this?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top