rudy.siregar Posted March 11, 2008 Share Posted March 11, 2008 hello all, I have code like this : -------------------------------------------------------------------------------------- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body> <script language="javascript"> var base_price = 0; var size = {}; var opts = {}; opts.Size = 0; function printcost(){ var price = base_price; for (p in size){ price += size[p]; } document.getElementById('price').innerHTML = price; } function updatePrice(opt, nilai){ size[opt] = nilai; printcost(); } function calc() { var total = document.getElementById('qty').value; } </script> Ukuran Kertas : <select name="ukuran_kertas" style="background-color:#f1f1f1; border-style:none; width:200 px; font-size:10px; font:Verdana " onchange="if (this.value == 'A6 (10,5 x 14, cm') updatePrice('PaperSize', 9); else if (this.value == 'A5 (14,8 x 21) cm') updatePrice('PaperSize', 4); else if (this.value == 'A4 (21 x 29,7) cm') updatePrice('PaperSize', 2); else if (this.value == 'A3 (29,7 x 42) cm') updatePrice('PaperSize', 1); else if (this.value == 'Letter (21,59 x 27,94) cm') updatePrice('PaperSize', 2); else if (this.value == 'Legal (21,59 x 35,56) cm') updatePrice('PaperSize', 2); else if (this.value == 'F4 (21,9 x 33) cm') updatePrice('PaperSize', 2); else updatePrice('PaperSize', 25);"> <option value="A6 (10,5 x 14, cm">A6 (10,5 x 14, cm</option> <option value="A5 (14,8 x 21) cm">A5 (14,8 x 21) cm</option> <option value="A4 (21 x 29,7) cm">A4 (21 x 29,7) cm</option> <option value="A3 (29,7 x 42) cm">A3 (29,7 x 42) cm</option> <option value="Letter (21,59 x 27,94) cm">Letter (21,59 x 27,94) cm</option> <option value="Legal (21,59 x 35,56) cm">Legal (21,59 x 35,56) cm</option> <option value="F4 (21,9 x 33) cm">F4 (21,9 x 33) cm</option> <option value="Kartu Nama (5,5 x 9) cm">Kartu Nama (5,5 x 9) cm</option> </select> <br /> Jumlah Pesanan : <input onChange="calc();" name="jumlah_pesanan" id="qty" type="text" style="background-color:#f1f1f1; border-style:none; width:200 px; font-size:10px; font:Verdana "> <br /> <br /> <div id="price" style="font-weight:bold;">9</div> <div id="lbr" style="font-weight:bold;">-</div> </body> </html> ------------------------------------------------------------------------------------------ i need to catch a value in input textfield and i will devided with value in id='price'. but the result is always [object]. why does it happen? Can u help me out this problem? coz i can't get the object value thats why i always take [object] result. thank you for attention, regards, rudy Link to comment https://forums.phpfreaks.com/topic/95588-how-to-get-object-value/ Share on other sites More sharing options...
haku Posted March 11, 2008 Share Posted March 11, 2008 You don't have a textfield anywhere in your code. Link to comment https://forums.phpfreaks.com/topic/95588-how-to-get-object-value/#findComment-489494 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.