getElementsByName
returns an array of elements an HTMLCollection which needs to be indexed.
Also, selectedIndex is a property that needs to be set
document.getElementsByName('commentselected')[0].selectedIndex = 2;
Here's a simple demo
Also, since your select already has an id, you might as well use getElementById
, like this