The logic in the fiddle function to swap, rows / columns / blocks are correct, and you can actually inspect the rowVal matrix, which stores correct value.
The problem lies on the way you assign the value to the input elements.
function putCellVal() {
var z = 0;
for(var i = 0; i < rowVal.length; i++) {
for(var j = 0; j < rowVal[i].length; j++) {
document.forms[0].elements[z].value = rowVal[i][j];
z++;
}
}
}
Apparently you use a table for each block, and from the assignment logic above, you are actually assigning a "row" of rowVal to a "block". You can check the value of rowVal[0], which is [1,9,8,4,2,3,6,5,7], the value in your first block
<table>
<tr>
<td><input type="text" name="x0y0" maxlength="1">
<td><input type="text" name="x1y0" maxlength="1">
<td><input type="text" name="x2y0" maxlength="1">
</tr>
<tr>
<td><input type="text" name="x0y1" maxlength="1">
<td><input type="text" name="x1y1" maxlength="1">
<td><input type="text" name="x2y1" maxlength="1">
</tr>
<tr>
<td><input type="text" name="x0y2" maxlength="1">
<td><input type="text" name="x1y2" maxlength="1">
<td><input type="text" name="x2y2" maxlength="1">
</tr>
</table>