AddClass to Table Row

The function below adds classes to buttons and disables / enables inputs in a table. I want to add a class to the more parent element being the <tr>. So in other words, when a checkbox is selected, add a class to the row in the table.

Table row = var row

I wasn’t sure where to put…

for (var i=0; i < row.length; i++) 
				addClass(row[i], "selected");


for (var i=0; i < row.length; i++) 
				removeClass(row[i], "selected");

in the script below. I kept crashing my browser.

function selectone() {

	var message 		= document.getElementById('pmform');
	var row 			= document.getElementsByName('row');
	//Input Id's
	var dt		 		= document.getElementById('deletetop');
	var db			 	= document.getElementById('deletebottom');
	var mt 				= document.getElementById('marktop');
	var mb		 		= document.getElementById('markbottom'); 
	//Span Id's
	var sdt				= document.getElementById('sdeletetop');
	var sdb				= document.getElementById('sdeletebottom');
	var smt				= document.getElementById('smarktop');
	var smb				= document.getElementById('smarkbottom'); 
	for (var i = 0; i < message.length; i++)
		if (message[i].checked == false)
			dt.disabled = true;
			db.disabled = true;
			mt.disabled = true;
			mb.disabled = true;
			addClass(sdt, "disabled");
			addClass(sdb, "disabled");
			addClass(smt, "disabled");
			addClass(smb, "disabled");
	for (var i = 0; i < message.length; i++)
		if (message[i].checked == true)
			dt.disabled = false;
			db.disabled = false;
			mt.disabled = false;
			mb.disabled = false;
			removeClass(sdt, "disabled");
			removeClass(sdb, "disabled");
			removeClass(smt, "disabled");
			removeClass(smb, "disabled");

Can you publish a link to some code so we can see how it all fits together?