Вывод цены без/со скидкой-в ИЕ "требуется объект",в других браузерах все в порядке.
Всем здравия!
Просьба помочь - во всех браузерах, кроме Ие, калькулятор считает нормально. Код: <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon"> <link rel="stylesheet" type="text/css" href="/css/global.css" /> <!--[if lte IE 7]><link rel="stylesheet" type="text/css" href="/css/ie.css" /><![endif]--> <!--[if lt IE 7]><link rel="stylesheet" type="text/css" href="/css/ie6.css" /><![endif]--> <!--[if IE 6]> <script src="/js/ddpng.js"></script> <![endif]--> <script type="text/javascript" src="/js/jquery.js"></script> <script type="text/javascript"> function calc_iva_1() { td = window.document.getElementById('b-carttbl__table'); spansum = td.getElementsByTagName('spansum'); allsum = 0; for(var q=0; q<spansum.length; q++){ allsum += parseFloat(spansum[q].firstChild.nodeValue); } secondsum = Number(allsum*21/100); secondsum1 = Number(secondsum.toFixed(2)); secondsum3 = Number(secondsum1.toFixed(2)); ivasum = allsum+secondsum3; ivasum = Number(ivasum.toFixed(2)); window.document.getElementById('totalsum').innerHTML = allsum.toFixed(2); window.document.getElementById('totalsum2').innerHTML = ivasum; } </script> <title>Co-Co Acquista</title> </head> <body onLoad = 'calc_iva_1()'> <div id="minWidth"> <i class="tpvis"><i class="l"></i><i class="r"></i></i> <div class="outer"> <div class="inner"> <div class="middle"> <h2 class="m-title">Cestino<br /><small class="note">Cambiamenti nella quantità dei prodotti comportano un ricalcolo automatico del totale.</small></h2> <p><a href="../production/katalogi-produkcii/produkciya-Co-Co-nsp/">Tornare al catalogo</a></p> <form method="post" class="cartform" id="cartform"> <input type="hidden" name="mode" value="cart" /> <div class="b-carttbl"> <table class="b-carttbl__table" id="b-carttbl__table"> <col width="1px" /> <col width="1px" /> <tr class="first"> <th colspan="2" class="miw"><i></i></th> <th><a href="/production/catalogue/catalogo-prodotti-Co-Co-nsp/gel-for-modeling/base-gel/">GEL BASE</a></th> <th>Articolo (Art. Nr.)</th> <th class="a-r">Quantità</th> <th class="a-r">Costo</th> <th></th> </tr> <tr> <td class="numb"><div class="numb-i">1</div></td> <td class="ph"> <div class="ph-i"><a href="/production/catalogue/catalogo-prodotti-Co-Co-nsp/gel-for-modeling/base-gel/#item331"><img src="/files/catalog/t1/matrih_copy.jpg" alt="" width="45" /></a></div> </td> <td class="txt"> <a href="/production/catalogue/catalogo-prodotti-Co-Co-nsp/gel-for-modeling/base-gel/#item331">Matrix 5 g</a><br /> Prezzo: 6.90 <span class="rur">eur.</span> </td> <td>Gb 1-5</td> <td class="a-r"> <input type="hidden" value="1" name="items[572][enable]" /> <input type="hidden" value="76" name="items[572][groupId]" /> <input type="text" value="4" name="items[572][count]" class="i-p count count572" active="1" itemid="572" price="6.90" sum="0" onChange='calc_iva_1()'/> </td> <td class="cost"> <spansum class="sum sum572" id="span_sum572"> 27.6</spansum> eur. <input type="hidden" value='27.6' class="sum sum572" id="span_sum572"/> </td> <td class="del"> <a class="deletelink" href="?mode=delete&item_id=572&group_id=76"></a> </td> </tr> <tr> <td class="numb"><div class="numb-i">2</div></td> <td class="ph"> <div class="ph-i"><a href="/production/catalogue/catalogo-prodotti-Co-Co-nsp/gel-for-modeling/base-gel/#item331"><img src="/files/catalog/t1/matrih_copy.jpg" alt="" width="45" /></a></div> </td> <td class="txt"> <a href="/production/catalogue/catalogo-prodotti-Co-Co-nsp/gel-for-modeling/base-gel/#item331">Matrix 15 g</a><br /> Prezzo: 18.90 <span class="rur">eur.</span> </td> <td>GB 1-15</td> <td class="a-r"> <input type="hidden" value="1" name="items[573][enable]" /> <input type="hidden" value="76" name="items[573][groupId]" /> <input type="text" value="4" name="items[573][count]" class="i-p count count573" active="1" itemid="573" price="18.90" sum="0" onChange='calc_iva_1()'/> </td> <td class="cost"> <spansum class="sum sum573" id="span_sum573"> 75.6</spansum> eur. <input type="hidden" value='75.6' class="sum sum573" id="span_sum573"/> </td> <td class="del"> <a class="deletelink" href="?mode=delete&item_id=573&group_id=76"></a> </td> </tr> <tr> <td class="numb"><div class="numb-i">3</div></td> <td class="ph"> <div class="ph-i"><a href="/production/catalogue/catalogo-prodotti-Co-Co-nsp/gel-for-modeling/base-gel/#item331"><img src="/files/catalog/t1/matrih_copy.jpg" alt="" width="45" /></a></div> </td> <td class="txt"> <a href="/production/catalogue/catalogo-prodotti-Co-Co-nsp/gel-for-modeling/base-gel/#item331">Matrix 50 g</a><br /> Prezzo: 49.90 <span class="rur">eur.</span> </td> <td>GB 1-50</td> <td class="a-r"> <input type="hidden" value="1" name="items[574][enable]" /> <input type="hidden" value="76" name="items[574][groupId]" /> <input type="text" value="4" name="items[574][count]" class="i-p count count574" active="1" itemid="574" price="49.90" sum="0" onChange='calc_iva_1()'/> </td> <td class="cost"> <spansum class="sum sum574" id="span_sum574"> 199.6</spansum> eur. <input type="hidden" value='199.6' class="sum sum574" id="span_sum574"/> </td> <td class="del"> <a class="deletelink" href="?mode=delete&item_id=574&group_id=76"></a> </td> </tr> <tr class="last"> <td class="total" colspan="7"> Totale: <span class="totalsum" id="totalsum">302.8</span> eur.<br><br> <span style="color:#1B4386;font-size:12px;">Costo di spedizione € 12,10</span><br> <span style='color:#A30000;'>Importo incluso IVA: <span id='totalsum2' class='totalsum2'></span> eur.</span><br> </td> </tr> </table> <script type="text/javascript"> var calc = function (form) { form.total = 0; $(form).find('.count').each(function (i, e) { if ($(e).attr('active')) { e.form.total += parseFloat($(e).attr('sum')); } }) $(form).find('.totalsum').html((form.total.toFixed(2))); } $('.count').keyup(function () { if (parseInt(this.value)) { this.value = parseInt(this.value); $(this).attr('sum', ($(this).attr('price') * $(this).val()).toFixed(2)); } else { this.value = ''; $(this).attr('sum', 0); } var id = $(this).attr('itemid'); $('.sum' + id).html($(this).attr('sum')); }); $('.count').keyup(function () {calc_iva_1();}); $('.count').click(function () {calc_iva_1();}); $('.count').focusin(function () {calc_iva_1();}); $('.count').focusout(function () {calc_iva_1();}); $('.buycheckbox').change(function () { $(this.form).find('.count' + this.value).attr('active', this.checked ? 1 : 0); }); $('.deletelink').click(function () { $.ajax({ url: this.href, context: this, success: function() { $(this).parent().parent().hide(300, function () { if ($(this).prev().hasClass('first') || $(this).prev().hasClass('sep')) { if ($(this).next().hasClass('sep') || $(this).next().hasClass('last')) { $(this).prev().remove(); if ($(this).next().hasClass('sep')) { $(this).next().remove(); } } } $(this).remove(); var form = $('form.cartform')[0]; calc_iva_1(); }); }}); return false; }); </script> </div> </div> </div> </div> <div class="bottom"> <div class="outer"> <div class="inner"> <div class="l-col-1"> <table collspan=0 border=0> <tr> <td style="padding-top:10px;"> </td> <td> </tr> </table> </div> </div> </div> </div> </body> </html> под давлением вывесил сырой и не протестил в Ие, теперь оказался виноватым...просьба помочь ибо мозги уже набекрень. конкретно ругается на эту allsum += parseFloat(spansum[q].firstChild.nodeValue); часть |
как вариант...поменять все теги spansum на span с одинаковым class, и ловить их через getElementsByClassName...
видить он их видит, но firstChild для него у них не существует, также как и innerHTML |
вставь в начало скрипта:
document.createElement('spansum'); |
Цитата:
чуял ведь что разгадка гето рядом но воспаленный моск отказывался работать. далее ошибка вылезла изза строки 157: " Неожиданный вызов метода или обращение к свойству." но ее поборол заменив $('.sum' + id).html($(this).attr('sum')); на var id = $(this).attr('itemid'); var cost_sum = $(this).attr('sum'); var span_sum_id = 'span_sum' + id; document.getElementById(span_sum_id).innerHTML = cost_sum; всех благодарствую! |
Часовой пояс GMT +3, время: 22:15. |