 <p>You can write your business logic in onchange function as shown below</p> <pre><code> &lt;form name="login" action="procesarAdd.do"&gt; &lt;br&gt; &lt;b&gt;CATEGORIA&lt;/b&gt; &lt;br&gt; &lt;input type="radio" name="g1" value="per" checked="checked" onchange="product(this.value)"/&gt;PERFUME &lt;input type="radio" name="g1" value="joy" onchange="product(this.value)"/&gt;JOYAS &lt;input type="radio" name="g1" value="car" onchange="product(this.value)"/&gt;BOLSO CARTERAS &lt;table border="1"&gt; &lt;tbody&gt; &lt;tr&gt; &lt;td&gt;ID Producto&lt;/td&gt; &lt;td&gt;&lt;input type="text" name="id" id ="field1" value="" /&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Nombre&lt;/td&gt; &lt;td&gt;&lt;input type="text" name="nombre" id ="field2" value="" /&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Stock&lt;/td&gt; &lt;td&gt;&lt;input type="text" name="stock" id ="field3" value="" /&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Precio&lt;/td&gt; &lt;td&gt;&lt;input type="text" name="precio" id ="field4" value="" /&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/tbody&gt; &lt;/table&gt; </code></pre> <p> <br></p> <p>Javascript function:</p> <pre><code> function product(x){ alert("Product Name : " +x); if(x=="per"){ document.getElementById("myImg").src = "https://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcScKsjtuajfWrNvk2pXTxf4Et2dPoCEsF58XVetpBrVCpDnLmAkVg" } if(x=="joy"){ document.getElementById("myImg").src = "https://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcQM3y6qUIwqIr164GbERvTyOXNMBYcWOueodxxwxzug16oFalPldiHJQV1r" } if(x=="car"){ document.getElementById("myImg").src = "https://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcS3P65pTpiNFx2psFeqOoF6iuXzQErc_gBUmAf6bn1846ghx1TrOw" } } </code></pre> <p>codepen URL for your reference: <a href="http://codepen.io/nagasai/pen/KMwGMg?editors=1010" rel="nofollow">http://codepen.io/nagasai/pen/KMwGMg?editors=1010</a></p> <p>Please let me know if you need any further details</p>