вы о чем какой js все на скриптах. у меня на сайте так реализовано и нормально
Код:
<form name="login_form" method="post">
<table height="100%" cellspacing="0" cellpadding="0" width="100%" border="0"><tbody><tr><td align="middle">
<table cellspacing="0" cellpadding="0" border="0" style="position: relative; top: 200px; right: -8px;">
<tbody>
<script>
function GetPoint(rating, coeff) {
if (rating<=1500) {
var points=coeff*(0.22*rating+14);
if (points <= 0) {
return 0;
}else{
return parseInt(points, 10);
}
}else{
return parseInt(coeff*(1511.26/(1+1639.28*Math.pow(2.71828, -0.00412*rating))), 10);
}
}
function GetRating(points, coeff) {
var rating = parseInt(Math.log((1511.26/(1639.28*points/coeff))-(1/1639.28))/(-0.00412),10);
if (rating <= 1500) {
return parseInt(((points/coeff)-14)/0.22,10);
}else{
return rating;
}
}
function RatingToPoints() {
var rating = parseInt(document.getElementById('rating_22').value,10);
if (rating > 0 && rating <= 4000) {
document.getElementById('points_22').value = GetPoint(rating, 0.76);
}else{
document.getElementById('points_22').value = 'Invalid Value';
}
rating = parseInt(document.getElementById('rating_33').value,10);
if (rating > 0 && rating <= 4000) {
document.getElementById('points_33').value = GetPoint(rating, 0.88);
}else{
document.getElementById('points_33').value = 'Invalid Value';
}
rating = parseInt(document.getElementById('rating_55').value,10);
if (rating > 0 && rating <= 4000) {
document.getElementById('points_55').value = GetPoint(rating, 1);
}else{
document.getElementById('points_55').value = 'Invalid Value';
}
}
function PointsToRating() {
var points = parseInt(document.getElementById('points').value,10);
rating = GetRating(points, 0.76);
if (rating > 0 && rating < 4000) {
document.getElementById('rat_22').value = rating;
}else{
document.getElementById('rat_22').value = 'Not Possible';
}
rating = GetRating(points, 0.88);
if (rating > 0 && rating < 4000) {
document.getElementById('rat_33').value = rating;
}else{
document.getElementById('rat_33').value = 'Not Possible';
}
rating = GetRating(points, 1);
if (rating > 0 && rating < 4000) {
document.getElementById('rat_55').value = rating;
}else{
document.getElementById('rat_55').value = 'Not Possible';
}
}
</script>
<style>
input { text-align: center; width: 100px; }
</style>
</tbody></table><table style="margin-top: 50px;">
<tbody><tr><th> </th><th>Рейтинг</th><th style="width: 150px;"> </th><th> </th><th>Поинты</th></tr>
<tr><td>2v2 : <br>3v3 :<br>5v5 :</td><td><input id="rating_22" type="text" value="1500"><br><input id="rating_33" type="text" value="1500"><br><input id="rating_55" type="text" value="1500"></td><td style="text-align: center;"><input type="button" value="Расчет =>" onclick="javascript: RatingToPoints();"></td><td>2v2 : <br>3v3 :<br>5v5 :</td><td><input id="points_22" type="text" value="" disabled="disabled"><br><input id="points_33" type="text" value="" disabled="disabled"><br><input id="points_55" type="text" value="" disabled="disabled"></td></tr>
<tr><th></th><th></th><th> </th><th> </th><th>Рейтинг</th></tr>
<tr><td></td><td style="text-align: right;" valign="top"><div style="text-align: center; font-weight: bold; margin-bottom: 4px;">Поинты</div><input id="points" type="text" value="850"></td><td style="text-align: center;"><input type="button" value="Расчет =>" onclick="javascript: PointsToRating();"></td><td>2v2 : <br>3v3 :<br>5v5 :</td><td><input id="rat_22" type="text" value="" disabled="disabled"><br><input id="rat_33" type="text" value="" disabled="disabled"><br><input id="rat_55" type="text" value="" disabled="disabled"></td></tr>
</tbody></table><br>
</td></tr></tbody></table> </form>