English 中文(简体)
甚至连基本的工作都无uck。
原标题:Having no luck at all even getting basic dojo to work

I am trying to develop some drag and drop functionality. First, I just want the thing to drag. I m reading a book "Getting Started with Dojo, Kyle Hayes", but am having no luck.

我的一些问题:

  1. When I connect to the newest dojo and Google s library, nothing works at all.
  2. Whenever I include djConfig="parseOnLoad in my initial script calling an older library from Google, nothing works. If I take out the djConfig="parseOnLoad, then the page begins to work.
  3. If I include dojo.require("dojo.dnd.Target"), I lose all functionality.
  4. and no matter what I do, I cannot get a simple div to drag.

I have included my code below, and sincerely appreciate any help anyone can give me in getting started.

<!DOCTYPE HTML>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/dojo/1.6/dojo/dojo.xd.js"                                                                  djConfig="parseOnLoad: true"></script>

<script type="text/javascript">
        //dojo.require("dojo.parser");
        dojo.require("dojo.dnd.move"); 
        dojo.require("dojo.dnd.Source");
        //dojo.require("dojo.dnd.Target");
        dojo.require("dijit.form.Button");
        dojo.require("dijit.form.TextBox");
        document.write("I got this far");

    var init = function()
    {
        dojo.connect(
        dojo.byId( btnSayHello ),
        "onclick",
        this,
        helloButton_onClick
        );
    }


    var helloButton_onClick = function(event)
    {
        alert ( Hello World and hello   + dojo.byId( txtName ).value +  ! );
    }

    dojo.addOnLoad(init);
</script>
</head>
<body>
<div id="dragMe" dojoType="dojo.dnd.move" style="border: 1 solid black; height: 300; width: 300;">
Source 1
</div>
<div id=Div1 dojoType="dojo.dnd.Target" style="border: 1 solid black; height: 300; width: 300;">
   Target
</div>
<div>
    <h1>Hello World Example</h1>
    <hr/>
    <label for="txtName">Your name:</label>
    <input id="txtName" type="text" dojoType="dijit.form.TextBox"/><br/>
    <button id="btnSayHello" dojoType="dijit.form.Button">Say Hello</button>
</body>
</html>
问题回答

我刚刚从dojoType=“dojo.dnd.move”改为dojoType=”dojo.dnd。 可变的“,我可以绕过这一条。 希望会有所帮助。





相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签