tobeyt23 Posted May 14, 2009 Share Posted May 14, 2009 <script type="text/javascript"> jQuery.noConflict(); var colors = []; var qtys = []; function buildList(id) { var showChecked = id.split('_'); if(document.getElementById(showChecked[0]+'_check').style.display == 'none') { if(colors.indexOf(id) < 0) { colors.push(id); document.getElementById(showChecked[0]+'_check').style.display = 'block'; } } else if(document.getElementById(showChecked[0]+'_check').style.display == 'block') { var index = colors.indexOf(id); colors.splice(index,1); document.getElementById(showChecked[0]+'_check').style.display = 'none'; } document.getElementById('selectList').style.display = (colors.length > 0) ? 'block' : 'none'; setQtys(); buildQtyList(); } function buildQtyList() { var html = ''; html +='<div align="center"><div style="color:#880108;text-align:center;font-style:italic;font-size:11px;width:60%;background-color:#FFFADA;padding:2px;">Minimum total order 12 per piece.</div></div>'; for(i=0;i<colors.length;i++) { tableColor = (i%2 == 0) ? '' : ' style="background:#d9d2d2;"'; nameHex = colors[i].split('_'); html += '<div id="'+nameHex[0].replace(' ','__')+'_qty"'+tableColor+'>'; html += '<table class="colorSizeQty" width="100%" style="text-align:center;">'; html += '<thead>'; html += '<tr>'; html += '<th width="100"> </th>'; html += '<th width="75"> </th>'; html += '<th style="text-align:center; font-size:10px; font-weight:normal;">ADULT</th>'; html += '</tr>'; html += '</thead>'; html += '<tbody>'; html += '<tr>'; html += '<td style="vertical-align:middle;">'+nameHex[0]+'</td>'; html += '<td style="vertical-align:middle; text-align:center;"><div style="width:50px; height:15px; border:1px solid #E4E4E4; background:#'+nameHex[1]+';"></div></td>'; html += '<td style="font-size:10px;"><table width="100%"><tr><td>SM<br><input type="text" name="Adult_SM_16_56" id="Adult_SM_16_56" size="2" /></td><td>MED<br><input type="text" name="Adult_MED_16_57" id="Adult_MED_16_57" size="2" /></td><td>LG<br><input type="text" name="Adult_LG_16_58" id="Adult_LG_16_58" size="2" /></td><td>XLG<br><input type="text" name="Adult_XLG_16_59" id="Adult_XLG_16_59" size="2" /></td><td>XXL<br><input type="text" name="Adult_XXL_16_60" id="Adult_XXL_16_60" size="2" /></td><td>3XL<br><input type="text" name="Adult_3XL_16_61" id="Adult_3XL_16_61" size="2" /></td><td>4XL<br><input type="text" name="Adult_4XL_16_62" id="Adult_4XL_16_62" size="2" /></td></tr></table></td>'; html += '</tr>'; html += '<tbody>'; html += '</table>'; html += '</div>'; } html +='<br><div align="center"><div style="color:#880108;text-align:center;font-style:italic;font-size:11px;width:60%;background-color:#FFFADA;padding:2px;">Minimum total order 12 per piece.</div></div>'; document.getElementById('selectedQtyList').innerHTML = html; changeId(); loadQtys(); } function changeId() { for(i=0;i<colors.length;i++) { nameHex = colors[i].split('_'); fields = jQuery('#'+nameHex[0].replace(' ','__')+'_qty input:eg(0)'); for(c=0;c<fields.length;c++) { jQuery('#'+nameHex[0].replace(' ','__')+'_qty #'+fields[c].id).attr('id' ,nameHex[0].replace(' ','__')+'_'+fields[c].id); jQuery('#'+nameHex[0].replace(' ','__')+'_qty #'+fields[c].id).attr('onblur' ,'setQtys();'); } } } function setQtys() { inputs = jQuery("#selectedQtyList :text[value!=]").get(); qtys = []; totalColors = false; qtyError = false; for(i=0;i<inputs.length;i++) { inputs[i].id = inputs[i].id.replace('__',' '); fieldColor = inputs[i].id.split('_'); if(jQuery.inArray(fieldColor[0], colors)) { if(qtys.indexOf(inputs[i]) < 0) qtys.push(inputs[i]); } } if(colors.length > 0) { totalColors = true; qtyError = false; if(qtys.length > 0) { for(i=0;i<qtys.length;i++) { if(qtys[i].value < 12) { qtyError = true; document.getElementById(qtys[i].id).style.backgroundColor = '#FFFADA'; } else document.getElementById(qtys[i].id).style.backgroundColor = '#ffffff'; } } else qtyError = true; } if(totalColors && qtyError == false) { var defaultColor = colors[0].split('_'); document.getElementById('default_color').value = defaultColor[0]; jQuery('#quote_button').removeAttr("disabled"); jQuery('#designer_button').removeAttr("disabled"); jQuery('#quote_button').css("background-color",""); jQuery('#quote_button').css("border",""); jQuery('#designer_button').css("background-color",""); jQuery('#designer_button').css("border",""); } else if (totalColors && qtyError) { document.getElementById('default_color').value = ''; jQuery('#quote_button').attr("disabled", true); jQuery('#designer_button').attr("disabled", true); jQuery('#quote_button').css("background-color","#93ADBC"); jQuery('#quote_button').css("border","1px solid #000"); jQuery('#designer_button').css("background-color","#93ADBC"); jQuery('#designer_button').css("border","1px solid #000"); } setDetails(); } function loadQtys() { if(qtys.length > 0) { for(i=0;i<qtys.length;i++) { qtys[i].id = qtys[i].id.replace(' ','__'); jQuery('#'+qtys[i].id).val(qtys[i].value); } } } function setDetails() { details = ''; detailColors = []; detailStyles = []; detailStylesId = []; detailSizes = []; detailSizesId = []; detailQtys = []; if(qtys.length > 0) { for(i=0;i<qtys.length;i++) { qtys[i].id = qtys[i].id.replace('__',' '); fieldColor = qtys[i].id.split('_'); detailColors.push(fieldColor[0]); detailStyles.push(fieldColor[1]); detailSizes.push(fieldColor[2]); detailStylesId.push(fieldColor[3]); detailSizesId.push(fieldColor[4]); detailQtys.push(qtys[i].value); } } details = {"colors": detailColors, "styles": detailStyles, "options": detailStylesId, "sizes": detailSizes, "selectids": detailSizesId, "qtys": detailQtys}; var detailsString = Object.toJSON(details); document.getElementById('print_details').value = detailsString; } </script> Link to comment https://forums.phpfreaks.com/topic/158170-why-does-this-only-work-in-ff/ Share on other sites More sharing options...
tobeyt23 Posted May 14, 2009 Author Share Posted May 14, 2009 jQuery('#'+nameHex[0].replace(' ','__')+'_qty #'+fields[c].id).attr('onblur' ,'setQtys();'); this seems to be the line with the issues Link to comment https://forums.phpfreaks.com/topic/158170-why-does-this-only-work-in-ff/#findComment-834323 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.