2012-05-07 49 views
0

我想开发一些拖放功能。 首先,我只是想要拖动的东西。 我正在读一本书“开始使用Dojo,Kyle Hayes”,但我没有运气。即使获得基本的dojo工作也没有运气

我的一些问题:

  1. 当我连接到最新的道场和谷歌的图书馆,没有什么工作都没有。
  2. 每当我在我的初始脚本中调用djConfig="parseOnLoad来调用谷歌较旧的库时,什么都不起作用。如果我拿出djConfig="parseOnLoad,那么该页面开始工作。
  3. 如果我包含dojo.require("dojo.dnd.Target"),我将失去所有功能。
  4. 无论我做什么,我都无法得到一个简单的div来拖动。

我在下面列入了我的代码,并衷心感谢任何人都可以帮助我入门。

<!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> 

回答

1

我刚从dojoType="dojo.dnd.move"变更为dojoType="dojo.dnd.Moveable",我可以拖动它。希望能帮助到你。

相关问题