I second Peter's recommendation to use jQuery. As well as simplifying a lot of the DOM-related stuff you'll need to do, it also abstracts the various browser incompatabilities, saving you a lot of headaches.
Another thing, too: DOM-related functions are pretty slow, so stuff like this:
code:
for (var i=0; i < document.listofoptions.Grp1.length; i++)
{
if (document.listofoptions.Grp1[i].checked)
{
var rad_val = document.listofoptions.Grp1[i].value;
}
}
Could be better written like this:
javascript code:
var radGrp = document.listofoptions.Grp1,
i = 0, len = radGrp.length,
radVal;
while (!radVal && i < len) {
if (radGrp[i].checked) {
radVal = radGrp[i].value;
}
i += 1;
}
This way you're cacheing the DOM element names, so they don't need to be looked up for each loop iteration, and also the conditions of the loop mean you don't continue to loop once you've found the value you want. It also saves you some typing if you need to do more stuff with the elements within the loop
:)
The way you've done it is fine for such a small-scale project, but it's a good idea to get into the habit of doing things "properly" from the start. If you really want to learn JavaScript the right way, I'd seriously recommend
this book by Douglas Crockford.