buenas tardes amigos, estoy teniendo problemas con un script, ya he buscado por la red y no he encontrada nada parecido.
estoy tratando que cuando el usuario selecciones una opcion del select option automáticamente en un imput text aparezca un contador, dicho contador lleva la suma de puntos que el usuario va acumulando. el problema es que el value del select option esta usado en un script y el valor que en realidad necesito que sume o reste esta en el text del option el cual va de -50 a 200.
[COLOR="rgb(139, 0, 0)"]les dejo el script:[/COLOR]
Código PHP:
var point=0;
function statpoint(){
var pointset = document.getElementById("pfrs");
var pointop1 = parseInt(pointset.options[pointset.selectedIndex].text);
var atrset = document.getElementById("atr");
var atrpoint = atrset.options[atrset.selectedIndex].value;
switch ("pointop1"){
case "-50":
point=atrpoint+pointop1;
atrpoint = point;
break;
case "-40":
point=atrpoint+pointop1;
atrpoint = point;
break;
case "-30":
point=atrpoint+pointop1;
atrpoint = point;
break;
case "-20":
point=atrpoint+pointop1;
atrpoint = point;
break;
point=atrpoint+pointop1;
atrpoint = point;
case "-10":
point=atrpoint+pointop1;
atrpoint = point;
break;
case "0":
point=atrpoint+pointop1;
atrpoint = point;
break;
case "10":
point=atrpoint+pointop1;
atrpoint = point;
break;
case "20":
point=atrpoint+pointop1;
atrpoint = point;
break;
case "30":
point=atrpoint+pointop1;
atrpoint = point;
break;
case "45":
point=atrpoint+pointop1;
atrpoint = point;
break;
case "60":
point=atrpoint+pointop1;
atrpoint = point;
break;
case "80":
point=atrpoint+pointop1;
atrpoint = point;
break;
case "100":
point=atrpoint+pointop1;
atrpoint = point;
break;
case "125":
point=atrpoint+pointop1;
atrpoint = point;
break;
case "150":
point=atrpoint+pointop1;
atrpoint = point;
break;
case "200":
point=atrpoint+pointop1;
atrpoint = point;
break;
}
document.form1.atr.text = atrpoint;
}
[COLOR="rgb(139, 0, 0)"]ak les dejo los html[/COLOR]
Código HTML:
<select id="pfrs" name="pfrs" size="1" onchange="calcula1(this.options.selectedIndex);statpoint(this.options.selectedIndex.text)">
<option value="5">-50</option>
<option value="6">-40</option>
<option value="7">-30</option>
<option value="8">-20</option>
<option value="9">-10</option>
<option value="10" selected="selected">0</option>
<option value="11">10</option>
<option value="12">20</option>
<option value="13">30</option>
<option value="14">45</option>
<option value="15">60</option>
<option value="16">80</option>
<option value="17">100</option>
<option value="18">125</option>
<option value="19">150</option>
<option value="20">200</option>
</select>
y el input: Código HTML:
<input name="atr" id="atr" value="0" readonly="readonly" />