SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Nov 2004
    Location
    chicago
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Calculator from IE to work in Mozilla

    I'm trying to get a JS calculator that works in IE to work in Mozilla, and I'm not sure what I need to be doing. The idea is that the user can check several items on a page and then calculate the total at the end of the page.

    The code is as follows:

    function load()
    {
    window.status = "pricecalc"
    }

    function count()
    {
    var vkabel2 = 300;
    var skabel2 = 800;
    var kylm2 = 120;

    /and so on...

    if (calc.vkabel.checked){
    var witem1 = document.calc.vkabel.value = vkabel2;
    } else {
    var witem1 = document.calc.vkabel.value = 0;
    }

    if (calc.skabel.checked){
    var witem2 = document.calc.skabel.value = skabel2;
    } else {
    var witem2 = document.calc.skabel.value = 0;
    }

    if (calc.kylm.checked){
    var witem3 = document.calc.kylm.value = kylm2;
    } else {
    var witem3 = document.calc.kylm.value = 0;
    }

    /and so on...

    nr1= document.calc.fieldnr1.value;
    nr2= document.calc.fieldnr2.value;
    nr3= document.calc.fieldnr3.value;

    /and so on...

    document.calc.pay.value = witem1 * nr1 + witem2 * nr2 + witem3 * nr3
    /and so on...


    Is there any way to convert this into something Mozilla would recognize, or will I need to do a whole new one?

    Thanks a lot for any help.

  2. #2
    SitePoint Zealot Arkkimaagi's Avatar
    Join Date
    Mar 2002
    Location
    Lappeenranta, Finland
    Posts
    176
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You need to show all of the code or an url where it's at, here's not much to go with.

  3. #3
    SitePoint Member
    Join Date
    Nov 2004
    Location
    chicago
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Here it is:

    function load()
    {
    window.status = "pricecalc"
    }

    function count()
    {
    var vkabel2 = 300;
    var skabel2 = 800;
    var kylm2 = 120;
    var transport2 = 40;
    var tuhast2 = 2700;
    var kiirtuhast2 = 3255;
    var tuhastpuit2 = 650;
    var tserekirst2 = 370;
    var drapkirst2 = 90;
    var morgist2 = 370;
    var kodust2 = 290;
    var transavtln2 = 7;
    var hauale2 = 200;
    var urnitransa2 = 150;
    var riietamine2 = 340;
    var kompress2 = 70;
    var pesemine2 = 130;
    var naopesu2 = 90;
    var transdesinf2 = 110;
    var ruumdesinf2 = 110;
    var transtarbed2 = 170;
    var vastuv2 = 105;
    var vastuv162 = 263;
    var urnisailit2 = 3;
    var nimeplaat2 = 65;
    var yhiskalm2 = 120;
    var lilled2 = 60;
    var peied2 = 60;
    var matusekone2 = 490;
    var orel2 = 405;
    var viiulk2 = 405;
    var viiulh2 = 455;
    var flootk2 = 405;
    var flooth2 = 455;
    var vokaal2 = 440;
    var orelviiul2 = 755;
    var tshelloviiul2 = 755;
    var tshello2 = 405;
    var meeskvart2 = 880;
    var metsasarv22 = 755;
    var keelpill2 = 1000;
    var metsasarv42 = 1000;
    var teenuskrema2 = 50;
    var teenus2 = 150;

    if (calc.vkabel.checked){
    var witem1 = document.calc.vkabel.value = vkabel2;
    } else {
    var witem1 = document.calc.vkabel.value = 0;
    }

    if (calc.skabel.checked){
    var witem2 = document.calc.skabel.value = skabel2;
    } else {
    var witem2 = document.calc.skabel.value = 0;
    }

    if (calc.kylm.checked){
    var witem3 = document.calc.kylm.value = kylm2;
    } else {
    var witem3 = document.calc.kylm.value = 0;
    }

    if (calc.transport.checked){
    var witem4 = document.calc.transport.value = transport2;
    } else {
    var witem4 = document.calc.transport.value = 0;
    }

    if (calc.tuhast.checked){
    var witem5 = document.calc.tuhast.value = tuhast2;
    } else {
    var witem5 = document.calc.tuhast.value = 0;
    }

    if (calc.kiirtuhast.checked){
    var witem6 = document.calc.kiirtuhast.value = kiirtuhast2;
    } else {
    var witem6 = document.calc.kiirtuhast.value = 0;
    }

    if (calc.tuhastpuit.checked){
    var witem7 = document.calc.tuhastpuit.value = tuhastpuit2;
    } else {
    var witem7 = document.calc.tuhastpuit.value = 0;
    }

    if (calc.tserekirst.checked){
    var witem8 = document.calc.tserekirst.value = tserekirst2;
    } else {
    var witem8 = document.calc.tserekirst.value = 0;
    }

    if (calc.drapkirst.checked){
    var witem9 = document.calc.drapkirst.value = drapkirst2;
    } else {
    var witem9 = document.calc.drapkirst.value = 0;
    }

    if (calc.morgist.checked){
    var witem10 = document.calc.morgist.value = morgist2;
    } else {
    var witem10 = document.calc.morgist.value = 0;
    }

    if (calc.kodust.checked){
    var witem11 = document.calc.kodust.value = kodust2;
    } else {
    var witem11 = document.calc.kodust.value = 0;
    }

    if (calc.transavtln.checked){
    var witem12 = document.calc.transavtln.value = transavtln2;
    } else {
    var witem12 = document.calc.transavtln.value = 0;
    }

    if (calc.hauale.checked){
    var witem13 = document.calc.hauale.value = hauale2;
    } else {
    var witem13 = document.calc.hauale.value = 0;
    }

    if (calc.urnitransa.checked){
    var witem14 = document.calc.urnitransa.value = urnitransa2;
    } else {
    var witem14 = document.calc.urnitransa.value = 0;
    }

    if (calc.riietamine.checked){
    var witem15 = document.calc.riietamine.value = riietamine2;
    } else {
    var witem15 = document.calc.riietamine.value = 0;
    }

    if (calc.kompress.checked){
    var witem16 = document.calc.kompress.value = kompress2;
    } else {
    var witem16 = document.calc.kompress.value = 0;
    }

    if (calc.pesemine.checked){
    var witem17 = document.calc.pesemine.value = pesemine2;
    } else {
    var witem17 = document.calc.pesemine.value = 0;
    }

    if (calc.naopesu.checked){
    var witem18 = document.calc.naopesu.value = naopesu2;
    } else {
    var witem18 = document.calc.naopesu.value = 0;
    }

    if (calc.transdesinf.checked){
    var witem19 = document.calc.transdesinf.value = transdesinf2;
    } else {
    var witem19 = document.calc.transdesinf.value = 0;
    }

    if (calc.ruumdesinf.checked){
    var witem20 = document.calc.ruumdesinf.value = ruumdesinf2;
    } else {
    var witem20 = document.calc.ruumdesinf.value = 0;
    }

    if (calc.transtarbed.checked){
    var witem21 = document.calc.transtarbed.value = transtarbed2;
    } else {
    var witem21 = document.calc.transtarbed.value = 0;
    }

    if (calc.vastuv.checked){
    var witem22 = document.calc.vastuv.value = vastuv2;
    } else {
    var witem22 = document.calc.vastuv.value = 0;
    }

    if (calc.vastuv16.checked){
    var witem23 = document.calc.vastuv16.value = vastuv162;
    } else {
    var witem23 = document.calc.vastuv16.value = 0;
    }

    if (calc.urnisailit.checked){
    var witem24 = document.calc.urnisailit.value = urnisailit2;
    } else {
    var witem24 = document.calc.urnisailit.value = 0;
    }

    if (calc.nimeplaat.checked){
    var witem25 = document.calc.nimeplaat.value = nimeplaat2;
    } else {
    var witem25 = document.calc.nimeplaat.value = 0;
    }

    if (calc.yhiskalm.checked){
    var witem26 = document.calc.yhiskalm.value = yhiskalm2;
    } else {
    var witem26 = document.calc.yhiskalm.value = 0;
    }

    if (calc.lilled.checked){
    var witem27 = document.calc.lilled.value = lilled2;
    } else {
    var witem27 = document.calc.lilled.value = 0;
    }

    if (calc.peied.checked){
    var witem28 = document.calc.peied.value = peied2;
    } else {
    var witem28 = document.calc.peied.value = 0;
    }

    if (calc.matusekone.checked){
    var witem29 = document.calc.matusekone.value = matusekone2;
    } else {
    var witem29 = document.calc.matusekone.value = 0;
    }

    if (calc.orel.checked){
    var witem30 = document.calc.orel.value = orel2;
    } else {
    var witem30 = document.calc.orel.value = 0;
    }

    if (calc.viiulk.checked){
    var witem31 = document.calc.viiulk.value = viiulk2;
    } else {
    var witem31 = document.calc.viiulk.value = 0;
    }

    if (calc.viiulh.checked){
    var witem32 = document.calc.viiulh.value = viiulh2;
    } else {
    var witem32 = document.calc.viiulh.value = 0;
    }

    if (calc.flootk.checked){
    var witem33 = document.calc.flootk.value = flootk2;
    } else {
    var witem33 = document.calc.flootk.value = 0;
    }

    if (calc.flooth.checked){
    var witem34 = document.calc.flooth.value = flooth2;
    } else {
    var witem34 = document.calc.flooth.value = 0;
    }

    if (calc.vokaal.checked){
    var witem35 = document.calc.vokaal.value = vokaal2;
    } else {
    var witem35 = document.calc.vokaal.value = 0;
    }

    if (calc.orelviiul.checked){
    var witem36 = document.calc.orelviiul.value = orelviiul2;
    } else {
    var witem36 = document.calc.orelviiul.value = 0;
    }

    if (calc.tshelloviiul.checked){
    var witem37 = document.calc.tshelloviiul.value = tshelloviiul2;
    } else {
    var witem37 = document.calc.tshelloviiul.value = 0;
    }

    if (calc.tshello.checked){
    var witem38 = document.calc.tshello.value = tshello2;
    } else {
    var witem38 = document.calc.tshello.value = 0;
    }

    if (calc.mk4.checked){
    var witem39 = document.calc.mk4.value = meeskvart2;
    } else {
    var witem39 = document.calc.mk4.value = 0;
    }

    if (calc.metsasarv2.checked){
    var witem40 = document.calc.metsasarv2.value = metsasarv22;
    } else {
    var witem40 = document.calc.metsasarv2.value = 0;
    }

    if (calc.keelpill.checked){
    var witem41 = document.calc.keelpill.value = keelpill2;
    } else {
    var witem41 = document.calc.keelpill.value = 0;
    }

    if (calc.metsasarv4.checked){
    var witem42 = document.calc.metsasarv4.value = metsasarv42;
    } else {
    var witem42 = document.calc.metsasarv4.value = 0;
    }

    if (calc.teenuskrema.checked){
    var witem43 = document.calc.teenuskrema.value = teenuskrema2;
    } else {
    var witem43 = document.calc.teenuskrema.value = 0;
    }

    if (calc.teenus.checked){
    var witem44 = document.calc.teenus.value = teenus2;
    } else {
    var witem44 = document.calc.teenus.value = 0;
    }

    nr1= document.calc.fieldnr1.value;
    nr2= document.calc.fieldnr2.value;
    nr3= document.calc.fieldnr3.value;
    nr4= document.calc.fieldnr4.value;
    nr5= document.calc.fieldnr5.value;
    nr6= document.calc.fieldnr6.value;
    nr7= document.calc.fieldnr7.value;
    nr8= document.calc.fieldnr8.value;
    nr9= document.calc.fieldnr9.value;
    nr10= document.calc.fieldnr10.value;
    nr11= document.calc.fieldnr11.value;
    nr12= document.calc.fieldnr12.value;
    nr13= document.calc.fieldnr13.value;
    nr14= document.calc.fieldnr14.value;
    nr15= document.calc.fieldnr15.value;
    nr16= document.calc.fieldnr16.value;
    nr17= document.calc.fieldnr17.value;
    nr18= document.calc.fieldnr18.value;
    nr19= document.calc.fieldnr19.value;
    nr20= document.calc.fieldnr20.value;
    nr21= document.calc.fieldnr21.value;
    nr22= document.calc.fieldnr22.value;
    nr23= document.calc.fieldnr23.value;
    nr24= document.calc.fieldnr24.value;
    nr25= document.calc.fieldnr25.value;
    nr26= document.calc.fieldnr26.value;
    nr27= document.calc.fieldnr27.value;
    nr28= document.calc.fieldnr28.value;
    nr29= document.calc.fieldnr29.value;
    nr30= document.calc.fieldnr30.value;
    nr31= document.calc.fieldnr31.value;
    nr32= document.calc.fieldnr32.value;
    nr33= document.calc.fieldnr33.value;
    nr34= document.calc.fieldnr34.value;
    nr35= document.calc.fieldnr35.value;
    nr36= document.calc.fieldnr36.value;
    nr37= document.calc.fieldnr37.value;
    nr38= document.calc.fieldnr38.value;
    nr39= document.calc.fieldnr39.value;
    nr40= document.calc.fieldnr40.value;
    nr41= document.calc.fieldnr41.value;
    nr42= document.calc.fieldnr42.value;
    nr43= document.calc.fieldnr43.value;
    nr44= document.calc.fieldnr44.value;

    document.calc.pay.value = witem1 * nr1 + witem2 * nr2 + witem3 * nr3 + witem4 * nr4 + witem5 * nr5 + witem6 * nr6 + witem7 * nr7 + witem8 * nr8 + witem9 * nr9 + witem10 * nr10 + witem11 * nr11 + witem12 * nr12 + witem13 * nr13 + witem14 * nr14 + witem15 * nr15 + witem16 * nr16 + witem17 * nr17 + witem18 * nr18 + witem19 * nr19 + witem20 * nr20 + witem21 * nr21 + witem22 * nr22 + witem23 * nr23 + witem24 * nr24 + witem25 * nr25 + witem26 * nr26 + witem27 * nr27 + witem28 * nr28 + witem29 * nr29 + witem30 * nr30 + witem31 * nr31 + witem32 * nr32 + witem33 * nr33 + witem34 * nr34 + witem35 * nr35 + witem36 * nr36 + witem37 * nr37 + witem38 * nr38 + witem39 * nr39 + witem40 * nr40 + witem41 * nr41 + witem42 * nr42 + witem43 * nr43 + witem44 * nr44;
    }

    Thanks


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •