DOJO按钮示例

DOJO按钮示例,dojo,Dojo,您好,我是学习DOJO的初学者…我尝试了以下代码,但当我按下hello world按钮时,没有显示警报框,请查找错误 <html> <head> <title>Button</title> <script src="http://ajax.googleapis.com/ajax/libs/dojo/1.5/dojo/dojo.xd.js"> dojo.require("dojo.event.*"); dojo.require("doj

您好,我是学习DOJO的初学者…我尝试了以下代码,但当我按下hello world按钮时,没有显示警报框,请查找错误

 <html>
<head>
<title>Button</title>
<script src="http://ajax.googleapis.com/ajax/libs/dojo/1.5/dojo/dojo.xd.js">
dojo.require("dojo.event.*");
dojo.require("dojo.widget.*");
dojo.require("dojo.widget.Button");
function hp()
{
alert("pressed");
}
function init()
{
var hellobutton=dojo.widgetById('helloButton');
}
dojo.event.connect(hellobutton,'onClick','hp');
dojo.addOnLoad(init);
</script>
</head>
<body bgcolor="#FFFFCC">
<p align="center"><font size="6" color="#800000">Welcome to Dojo Project</font></p>
<button dojoType="Button" widgetId="helloButton" onClick="hp();">HelloWorld!</Button>
<br>
</body>
</html>

我认为问题在于,javascript没有开始脚本标记。如果您这样做,您的代码工作正常

这里有一把小提琴:

你应该看看你是如何打开和结束你的标签的——以小写字母开头,以大写字母结尾是不合适的

 <button></Button>

您好,Miriam

非常感谢您,它工作得很好没问题-有关dojo的更多信息和教程,请查看:
 <button></Button>