var tipo=0;
function funciona(tipo){
var insert1 = document.getElementById("value1").value;
var insert2 = document.getElementById("value2").value;
var insert3 = document.getElementById("value3").value;
var insert4 = insert3 * 1.21 - insert3;
var insert5 = insert3 - insert4;
var objecte_1 = new Objeto(insert1, insert2, insert3, insert4, insert5);
function Objeto(nombre, descr, pt, iva, pb){
this.nombre = nombre;
this.descr = descr;
this.pt = pt;
this.iva = iva;
this.pb = pb;
}
Objeto.prototype.getNombre = function(){
return this.nombre;
}
Objeto.prototype.setNombre = function(nom){
this.nombre = nombre;
}
Objeto.prototype.getDescr = function(){
return this.descr;
}
Objeto.prototype.setDescr = function(descr){
this.descr = descr;
}
Objeto.prototype.getPt = function(){
return this.pt;
}
Objeto.prototype.setPt = function(pt){
this.pt = pt;
}
Objeto.prototype.getIva = function(){
return this.iva;
}
Objeto.prototype.setIva = function(iva){
this.iva = iva;
}
Objeto.prototype.getPb = function(){
return this.pb;
}
Objeto.prototype.setPb = function(pb){
this.pb = pb;
}
varif(tipo == 1){
alert(objecte_1.iva);
= new Objeto }if(insert1,tipo insert2,== insert3,2){
insert4, insert5 alert(objecte_1.pb);
}if(tipo ==3){
alert(objecte_1.pt);
}
}
<DOCTYPE html>
<html lang="es">
<head>
<meta charset="utf-8" />
<title></title>
<! <link href="css/estilo.css" rel="stylesheet" type="text/css"/>
</head>
< <body>
<table>
<tr>
<th>Nombre:</th><th><input type="text" id="value1"></th>
</tr>
<tr>
<th>Descripcion</th><th><input type="text" id="value2"></th>
</tr>
<tr>
<th>Precio:</th><th><input type="text" id="value3"></th>
</tr>
<tr>
<th><button onclick="funciona(1)";" > Calcula IVA</button></th>
<th><button onclick="funciona(2)" >Calcula Preu brut </button></th>
<th><button onclick="funciona(3)" > Calcula Total</button></th>
</tr>
</table>
</body>
</html>