我对上述程序有两个问题
按钮的宽度显得非常小
如何以编程方式更改按钮的颜色意味着单击此按钮我有功能?
dojo.setStyle(“bid”,“color”,“red”);
但两者都不起作用
<html>
<head>
<link rel="stylesheet" type="text/css"
href="http://ajax.googleapis.com/ajax/libs/dojo/1.6/dijit/themes/claro/claro.css"/>
<script src="http://ajax.googleapis.com/ajax/libs/dojo/1.6/dojo/dojo.xd.js"
djConfig="parseOnLoad: true">
</script>
<script>
dojo.require("dijit.form.Button");
</script>
</head>
<body class="claro">
<div dojoType="dijit.form.Button" id="bid" style="color: green;width: 335px; font-size:12px;"></div>Save
</body>
</html>
答案 0 :(得分:1)
您想要的方法是样式,而不是setStyle,因此请使用:
dojo.style("bid", "color", "red");
要使按钮变大,请在div中添加一些文字:
<div dojoType="dijit.form.Button" id="bid" style="color: green;width: 335px; font-size:12px;">Save</div>