0

i want to show prod name when i click on second buttton then show me pro2 but now here pro2 directly show .why i can't understan

<html> <body> <form> <input type="button" value="question1" id="abut" onclick=" return f1(0)"> <input type="button" value="question2" id="pbut" onclick=" return f1(1)"><br> <label id="guess what??"></label><br><br><br> <label id="guess what1??"></label> </form> <script> var catalog = { "products": [ { "name": "prod 1", "versions": [ "ver 1", "ver 2" ] }, { "name": "prod 2", "versions": [ "ver 1", "ver 2" ] } ] }; function f1(count){ for(var i = 0; i < catalog.products.length; i++) { var product = catalog.products[count]; var productName = product.name; document.getElementById('guess what??').innerHTML= productName; for(var j = 0; j < product.versions.length; j++) { var version = product.versions[j]; } } } </script> </body> </html>

28th Mar 2019, 1:34 AM
Jitendra Kumar
Jitendra Kumar - avatar
1 Odpowiedź
0
://It's working fine, nothing issues like you defined
28th Mar 2019, 3:44 AM
Sudarshan Rai
Sudarshan Rai - avatar