<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script>
function rub(rub){
var div = document.getElementById('cena');
var elems = div.getElementsByTagName('td');
for (var i=0; i<elems.length; i++){
var summ = elems[i].getElementsByTagName('span').innerHTML;
var valut = elems[i].getElementsByTagName('i').innerHTML;
if (valut == '$'){
elems[i].getElementsByTagName('span').innerHTML = summ*rub;
elems[i].getElementsByTagName('i').innerHTML = 'руб.';
}
else
{
elems[i].getElementsByTagName('span').innerHTML = summ / rub;
elems[i].getElementsByTagName('i').innerHTML = '$';
}
}
}
</script>
</head>
<body>
<table border="1">
<div>
<tr id="cena">
<th scope="row" class="spec">1 месяц</th>
<td class="one"><span>4</span><i>$</i></td>
<td class="one"><span>4</span><i>$</i></td>
<td class="one"><span>4</span><i>$</i></td>
<td class="one"><span>4</span><i>$</i></td>
<td class="one"><span>4</span><i>$</i></td>
</tr>
</div>
</table>
<input type="button" onclick="java: rub('35.2')" value="GO" />
</body>
</html>
Не че не происходит...