0
我想开发一些拖放功能。 首先,我只是想要拖动的东西。 我正在读一本书“开始使用Dojo,Kyle Hayes”,但我没有运气。即使获得基本的dojo工作也没有运气
我的一些问题:
- 当我连接到最新的道场和谷歌的图书馆,没有什么工作都没有。
- 每当我在我的初始脚本中调用
djConfig="parseOnLoad
来调用谷歌较旧的库时,什么都不起作用。如果我拿出djConfig="parseOnLoad
,那么该页面开始工作。 - 如果我包含
dojo.require("dojo.dnd.Target")
,我将失去所有功能。 - 无论我做什么,我都无法得到一个简单的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>