[Javascript] js in chrome vs firefox

jm jm5379 at gmail.com
Wed Jan 12 13:53:08 CST 2011


js and oo are not my strong points so bear with me as i undoubtedly
miss the proper naming conventions.  i have a page where one small
portion behaves differently in chrome than it does in firefox and even
ie.  the part in question is a group of text inputs where the user can
enter the number of items they wish to purchase (1 of this item, 4 of
that item, etc.)  as each field is populated, a dynamic table is
recreated at the bottom of the page showing the new counts and
purchase prices.  this works perfectly in firefox and ie (amazingly
enough) but refuses to update properly in chrome.  below is the part
of the script in question:

//      include all selected memorabilia for which a price is charged
var itemList = '';      // debugging
for(var item in document.forms.registration) {
  itemList += ', ' + item;        // debugging
  //      process only those values whose name begins with 'memorabilia'
  if (item.match(/^memorabilia/)) {
    item = eval('document.forms.registration.' + item);
    var itemPrice = eval('document.forms.registration.purchase_' + item.name);
    var itemDescription = eval('document.forms.registration.describe_'
+ item.name);
    if (item.value != '') {
      paypalTotal += parseInt(item.value) * parseFloat(itemPrice.value);
      addTableRow('+', (parseInt(item.value) *
parseFloat(itemPrice.value)), '(' + item.value + ') ' +
itemDescription.value);
    }
  }
}
alert (itemList);       // debugging

below are the return values in the alert (itemList) in chrome and
firefox.  the values i am specifically interested in are the ones
beginning 'memorabilia_'.  these show fine in firefox but appear as
the numerical entries 0 - 113 (the 'memorabilia_x' names apparently
buried in their structures) in chrome:

chrome:
, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69,
70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86,
87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102,
103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, clientLeft,
scrollHeight, firstElementChild, offsetWidth, nodeType,
isContentEditable, hidden, previousElementSibling, parentElement,
children, noValidate, localName, nodeValue, lastElementChild,
offsetLeft, tagName, length, className, prefix, innerHTML,
previousSibling, namespaceURI, enctype, id, childElementCount,
encoding, method, lastChild, innerText, clientHeight, target,
textContent, nextSibling, scrollWidth, offsetHeight, name,
clientWidth, nodeName, style, lang, scrollTop, offsetTop, childNodes,
baseURI, nextElementSibling, classList, title, firstChild, attributes,
acceptCharset, dataset, outerText, parentNode, clientTop, action,
tabIndex, dir, elements, outerHTML, contentEditable, scrollLeft,
ownerDocument, offsetParent, spellcheck, draggable, submit, reset,
checkValidity, insertAdjacentHTML, insertAdjacentText,
insertAdjacentElement, getAttribute, setAttribute, removeAttribute,
getAttributeNode, getElementsByTagName, getAttributeNS,
setAttributeNS, removeAttributeNS, getElementsByTagNameNS,
getAttributeNodeNS, hasAttribute, hasAttributeNS, focus, blur,
scrollIntoView, scrollIntoViewIfNeeded, scrollByLines, scrollByPages,
getElementsByClassName, querySelector, querySelectorAll,
webkitMatchesSelector, getClientRects, getBoundingClientRect,
setAttributeNode, removeAttributeNode, setAttributeNodeNS, contains,
insertBefore, replaceChild, removeChild, appendChild, hasChildNodes,
cloneNode, normalize, isSupported, hasAttributes, lookupPrefix,
isDefaultNamespace, lookupNamespaceURI, addEventListener,
removeEventListener, isSameNode, isEqualNode, compareDocumentPosition,
dispatchEvent, ELEMENT_NODE, ATTRIBUTE_NODE, TEXT_NODE,
CDATA_SECTION_NODE, ENTITY_REFERENCE_NODE, ENTITY_NODE,
PROCESSING_INSTRUCTION_NODE, COMMENT_NODE, DOCUMENT_NODE,
DOCUMENT_TYPE_NODE, DOCUMENT_FRAGMENT_NODE, NOTATION_NODE,
DOCUMENT_POSITION_DISCONNECTED, DOCUMENT_POSITION_PRECEDING,
DOCUMENT_POSITION_FOLLOWING, DOCUMENT_POSITION_CONTAINS,
DOCUMENT_POSITION_CONTAINED_BY,
DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC

firefox:
, student_first_name, student_last_name, custodian_first_name,
custodian_last_name, student_address_1, student_address_2,
student_city, dropdown_state, student_zip, student_phone_primary,
student_phone_secondary, student_phone_tertiary,
student_email_primary, student_email_secondary, dropdown_school_grade,
dropdown_teacher, teacher_first_name, teacher_last_name,
teacher_telephone, teacher_email, student_years_of_study,
dropdown_sightreading_skill, dropdown_level, student_honors,
student_recently_performed_solos, late_registration_date_2, camp_id,
deduction_student_hosting_2, tuition_2, tuition_2,
student_scholarship_amount_2, students_hosted_count_2,
solo_competition_entry_fee_2, solo_understand_location_2,
solo_understand_requirements_2,
solo_understand_teacher_recommendation_2, solo_piece_title_2,
solo_piece_composer_2, solo_piece_length_2,
solo_competition_accompanist_fee_2, elective_1, elective_79,
elective_46, elective_58, elective_2, elective_80, elective_47,
elective_59, elective_124, elective_3, elective_81, elective_48,
elective_91, elective_60, elective_99, elective_125, elective_4,
elective_82, elective_49, elective_92, elective_100, elective_126,
elective_5, elective_83, elective_50, elective_93, elective_61,
elective_101, elective_113, elective_127, elective_6, elective_84,
elective_51, elective_94, elective_102, elective_114, t_shirt_2,
t_shirt_2, t_shirt_2, t_shirt_2, t_shirt_2, t_shirt_2, t_shirt_2,
t_shirt_2, t_shirt_2, memorabilia_8, purchase_memorabilia_8,
describe_memorabilia_8, memorabilia_7, purchase_memorabilia_7,
describe_memorabilia_7, memorabilia_6, purchase_memorabilia_6,
describe_memorabilia_6, memorabilia_5, purchase_memorabilia_5,
describe_memorabilia_5, memorabilia_4, purchase_memorabilia_4,
describe_memorabilia_4, cmd, business, no_shipping, currency_code,
item_name, quantity, cancel_return, lc, bn, querySelector,
querySelectorAll, scrollWidth, clientLeft, clientHeight, clientWidth,
clientTop, getClientRects, getBoundingClientRect,
getElementsByClassName, mozMatchesSelector, baseURI, textContent,
compareDocumentPosition, getUserData, isSameNode, lookupNamespaceURI,
setUserData, lookupPrefix, isDefaultNamespace, isEqualNode,
dispatchEvent, removeEventListener, style, contentEditable,
offsetParent, innerHTML, offsetLeft, offsetTop, offsetHeight,
offsetWidth, elements, name, length, target, action, submit,
className, id, title, tagName, removeAttributeNS, removeAttribute,
getAttribute, getElementsByTagName, setAttribute,
getElementsByTagNameNS, hasAttributeNS, setAttributeNS, hasAttribute,
getAttributeNS, nextSibling, firstChild, prefix, nodeValue,
childNodes, nodeName, namespaceURI, previousSibling, nodeType,
localName, lastChild, ownerDocument, parentNode, attributes,
appendChild, cloneNode, normalize, hasChildNodes, insertBefore,
replaceChild, removeChild, hasAttributes, isSupported, ELEMENT_NODE,
ATTRIBUTE_NODE, TEXT_NODE, CDATA_SECTION_NODE, ENTITY_REFERENCE_NODE,
ENTITY_NODE, PROCESSING_INSTRUCTION_NODE, COMMENT_NODE, DOCUMENT_NODE,
DOCUMENT_TYPE_NODE, DOCUMENT_FRAGMENT_NODE, NOTATION_NODE,
getAttributeNode, setAttributeNode, removeAttributeNode,
getAttributeNodeNS, setAttributeNodeNS, lang, dir, acceptCharset,
enctype, method, encoding, tabIndex, draggable, blur, focus,
spellcheck, getFeature, DOCUMENT_POSITION_DISCONNECTED,
DOCUMENT_POSITION_PRECEDING, DOCUMENT_POSITION_FOLLOWING,
DOCUMENT_POSITION_CONTAINS, DOCUMENT_POSITION_CONTAINED_BY,
DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC, scrollTop, scrollLeft,
scrollHeight, firstElementChild, lastElementChild,
previousElementSibling, nextElementSibling, childElementCount,
children, classList

QUESTION: is there a single way to program this part so that all these
browsers correctly find, process and display the desired data?

thanks in advance,
joe

-- 
since this is a gmail account, please verify the mailing list is
included in the reply-to addresses.
also, i Never forward info on products of any sort so if you get
anything promoting any product period, ignore and delete it.  i have
received a number of failed delivery notices indicating my email
address is being used without my knowledge or permission.


More information about the Javascript mailing list