javascript - How can I view, calculate and show total price with this form? -


html:

<div class="simplecart_shelfitem">     <img src="image/frod001.gif" alt="" />     <p class="item_name">fishing rod model 001</p>     <span class="item_price">bnd $189.95</span><br/>                 qty: <input type="text" class="item_quantity" value="1" style="width:20px;"/><br/>     <input type="button" onclick="calculatetext();" value="add cart" /> </div>  

i new coding , javascript. want button working without php, javascript

modify html, change span this:

<span class="item_price">bnd <label id="price">189.95</label></span><br/>  

and js:

function calculatetext(){ var price=document.getelementbyid("price").innertext var quantity=document.getelementsbyclassname("item_quantity")[0].value var total=price*quantity alert("total: $"+total)  } 

Comments

Popular posts from this blog

c# - How Configure Devart dotConnect for SQLite Code First? -

java - Copying object fields -

c++ - Clear the memory after returning a vector in a function -