Some points. Don't feel you have to respond to each one.
1/ document.getElementById() should be done using dojo.byId() in dojo.
2/ use dijit.byId(x) to get a reference to the dijit object for the element with id x.
3/ versions of dijit below 1.4 should use dijit.attr(x, y) to set attribute x to value y.
4/ don't include both dojo.js and dojo.xd.js .. they're two versions of the same thing for use in completely different situations.
5/ usually better to use console.log because it doesn't interrupt the flow of execution, can log objects, and can log several statements one after the other, rather than each one disappearing when you click OK on the alert window.
6/ why on earth use such an old version of dojo? it looks like you're learning how to use dojo, not maintaining a legacy app.. so use the latest stable release, 1.5.0.
Try this code. I've not tested it, just hacked your post around until it looks more sane in places. Let us know if this clarifies things for you.
<html>
<head>
<style type="text/css">
@import "dojoroot/dijit/themes/tundra/tundra.css";
@import "dojoroot/dojo/resources/dojo.css"
</style> <script type="text/javascript" src="dojoroot/dojo/dojo.js"
djConfig="parseOnLoad: true"></script>
<script type="text/javascript">
dojo.require("dijit.form.Button");
dojo.require("dijit.form.RadioButton");
</script>
<script type="text/javascript">
function set_next_Radio()
{
var radioLength = document.radioObj.r1.length;
for(var i = 1; i <= radioLength; i++) {
var radioButton = dijit.byId("r" + i);
console.log("resolved ", i, " to ", radioButton);
if (radioButton && radioButton.attr('checked') == true) {
console.log("radioButton ", radioButton, " is checked");
radioButton.attr('checked', false);
} else {
console.log("radioButton number " + i + " not found.");
}
}
}
</script>
</head>
<body class="tundra">
<div>
<form name="radioObj">
<input type="radio" dojoType="dijit.form.RadioButton" name="r1" value="1" id="r1" checked=1/> | <input type="radio" dojoType="dijit.form.RadioButton" name="r1" value="2" id="r2" /> | <input type="radio" dojoType="dijit.form.RadioButton" name="r1" value="3" id="r3" /> | <input type="radio" dojoType="dijit.form.RadioButton" name="r1" value="4" id="r4" /> | <button dojoType="dijit.form.Button" type="button" id="b1" value="next" onClick="set_next_Radio();"> > </button> |
</form>
</div>
</body>
</html>