SitePoint Sponsor

User Tag List

Results 1 to 13 of 13
  1. #1
    SitePoint Guru htown's Avatar
    Join Date
    Mar 2005
    Posts
    661
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Scripts works in FF but not IE 6 or 7, WHY?

    I am not a Javscript professional to say the least but have dragged and tripped and stumbled to get to this point with the a lot of help of some friends both in here and outside.

    My client was having a fit with me when I told him that what he was complaining about was working fine for me. (I was using FF) and it was not for him. I really didn't dream that there would be a difference how the two browsers used JavaScript but it seems as though I am wrong.

    After filling out this form and pressing SUBMIT you are taken to a thank you page with a total. FF shows the total while IE shows nothing.

    Can someone please tell me why. I can't take it any more.

    Thanks,
    Houston
    Houston Brown
    Split Light Designs
    Bringing your ideas to light.

  2. #2
    SitePoint Aficionado JVLB's Avatar
    Join Date
    Jan 2002
    Location
    N 44 56.537' W 123 3.683'
    Posts
    1,127
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It would be helpful if you could provide the script that does the calculation and presents the total. Also, any IE error messages will be helpful; they are usually found in the lower left corner of the browser window chrome.

    If you are a fine, intelligent, upstanding, perceptive individual of sterling character who runs Linux for web development, you can easily install several IEs with the shell script found here: http://www.tatanka.com.br/ies4linux/page/Main_Page

    If you are one of those people using Windows or a Mac, however, you're on your own.

  3. #3
    SitePoint Guru htown's Avatar
    Join Date
    Mar 2005
    Posts
    661
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This page is not build using frames but for some reason FF sees it as such. However, if you can do a view source, you can see the JavaScript code.

    I am running FF, IE6 and IE7 on the same computer and as I mentioned it does not work on either of the IE's.

    I guess I am not a a fine, intelligent, upstanding, perceptive individual of sterling character, because I am not running Linux. But hopefully you can still help me.

    Just in case you can not see the code here is the javascript:
    Code:
    <script type="text/javascript">
    <!--
    function cu(p_name) {
    
        // get the elements
        var element = document.forms['quotesheet'].elements[p_name];
        var element_m = document.forms['quotesheet'].elements['m'+p_name];
        
        // default values for the number of items and the weight thing
        var v_item = 0;
        var v_wt = 1;
        
        // default value for the result
        var result = 0;
    
        // check that the element exists
        if( element ) {
            if( !isNaN(parseFloat(element.value)) )
                v_item = parseFloat(element.value);
            
            // check that the "m" element exists (if not, the value stays at 1)
            if( element_m ) {
                if( !isNaN(parseFloat(element_m.value)) )
                    v_wt = parseFloat(element_m.value);
            }
            
            // check if this element is a checkbox, if it is and it's not checked, set the value to zero
            if( element.getAttribute("type") == "checkbox" ) {
                if( !element.checked ) {
                    v_item = 0;
                }
            }
        
            // calculate the result
            result = v_item * v_wt;
            
        }
                    
        return result;
    
    }
    
    function calc() { 
    
    var f=document.quotesheet; 
    
    // calc all but mileage var
    v_total =
    cu('Sofa') +
    cu('Sectional_Sofa') +
    cu('Sleeper_Sofa') +
    cu('ChaseLounge') +
    cu('Recliner') +
    cu('Ottoman') +
    cu('Ent_Center') +
    cu('EntSm') +
    cu('EndTbl') +
    cu('CoffeeEntry') +
    cu('tvStand') +
    cu('tv30') +
    cu('tv31') +
    cu('tv41') +
    cu('tv60') +
    cu('VCR_Stereo') +
    cu('SpeakersLg') +
    cu('FireplaceTools') +
    cu('Hall_tree') +
    cu('Grandfather_Clock') +
    cu('CurioCabReg') +
    cu('CurioCabLg') +
    cu('PianoUp') +
    cu('PianoGrand') +
    cu('Dinning_table') +
    cu('dinning_chairs') +
    cu('buffet_server') +
    cu('china_cabinet') +
    cu('TblLeaf') +
    cu('Microwave') +
    cu('ServMicroCart') +
    cu('FrigFreeze') +
    // cu('FrigFreezeS') +
    cu('WashDry') +
    cu('StoveWash') +
    cu('WashDryS') +
    cu('King_bed') +
    cu('King_beds') +
    cu('Queen_bed') +
    cu('Queen_beds') +
    cu('FullBed') +
    cu('Fullbeds') +
    cu('TwinToddler') +
    cu('TwinToddlers') +
    cu('HeadFoot') +
    cu('WaterBridge') +
    cu('WaterBridges') +
    cu('TrundleBunk') +
    cu('TrundleBunks') +
    cu('Crib') +
    cu('Cribs') +
    cu('Armoire') +
    cu('Dresser_chest') +
    cu('JewlArm') +
    cu('CedarFoot') +
    cu('Clothing') +
    cu('Office_Desk') +
    cu('RollTop') +
    cu('RollTops') +
    cu('Credenza') +
    cu('Small_desk') +
    cu('DeskHutchSm') +
    cu('DeskHutchLg') +
    cu('DeskReturn') +
    cu('DeskExtension') +
    cu('Desk_chair') +
    cu('DeskEraser') +
    cu('BookcaseLg') +
    cu('BookcaseSm') +
    cu('FourdrawerStd') +
    cu('TwodrawerStd') +
    cu('FourdrawerLat') +
    cu('TwodrawerLat') +
    cu('CopierPrinterLg') +
    cu('CopierPrinterSm') +
    cu('ComputerMonitor') +
    cu('MowerEdger') +
    cu('TrimBlow') +
    cu('LadderWheel') +
    cu('GardenTools') +
    cu('StorageMetalLg') +
    cu('StorageMetalSm') +
    cu('PatioTable') +
    cu('PatioChairs') +
    cu('BoxGreater40') +
    cu('BoxLess40') +
    cu('WardrobeBox') +
    cu('PicGlasMarbLg') +
    cu('PicGlasMarbSm') +
    cu('PlantTreeSm') +
    cu('TreeLg') +
    cu('RugLg') +
    cu('RugSM') +
    cu('LampTable') +
    cu('Bench');
    
    
    // mileage - add charge
    v_mileage = parseFloat((f.mileage.value) * 2.50) + 50;
    // if( v_mileage < 50 ) v_mileage = 50;
    
    
    // elevator, stairs, walk - multiplier
    v_mult = 0;
    if( f.pu_elevator.checked ) v_mult += 1;
    else v_mult += f.pu_Stairs.selectedIndex;
    v_mult += parseFloat(f.pickwalk.options[f.pickwalk.selectedIndex].value);
    if( f.do_elevator.checked ) v_mult += 1;
    else v_mult += f.do_Stairs.selectedIndex;
    
    v_mult += parseFloat(f.dropwalk.options[f.dropwalk.selectedIndex].value);
    v_mult = 1.0 + (v_mult * 0.1);
    
    
    v_total = (v_total * v_mult) + v_mileage;
    // determine whether r/f surcharge
    if( document.forms['quotesheet'].elements['FrigFreeze'].value && document.forms['quotesheet'].elements['FrigFreezeS'].value != 'Service' ) {
    
        var v_ct = parseInt(document.forms['quotesheet'].elements['FrigFreeze'].value);
        var v_amt = 0.00;
        if( document.forms['quotesheet'].elements['FrigFreezeS'].value == 'Disc.' ) v_amt = 10.00;
        if( document.forms['quotesheet'].elements['FrigFreezeS'].value == 'Recn.' ) v_amt = 10.00;
        if( document.forms['quotesheet'].elements['FrigFreezeS'].value == 'Both' ) v_amt = 20.00;
    
    
    
        v_total += (v_ct * v_amt);
    }
    if( document.forms['quotesheet'].elements['WashDry'].value && document.forms['quotesheet'].elements['WashDryS'].value != 'Service' ) {
    
        var v_ct = parseInt(document.forms['quotesheet'].elements['WashDry'].value);
        var v_amt = 0.00;
        if( document.forms['quotesheet'].elements['WashDryS'].value == 'Disc.' ) v_amt = 10.00;
        if( document.forms['quotesheet'].elements['WashDryS'].value == 'Recn.' ) v_amt = 10.00;
        if( document.forms['quotesheet'].elements['WashDryS'].value == 'Both' ) v_amt = 20.00;
    
        // amount to add to total - v_total ;
        v_total += (v_ct * v_amt);
    }
    v_total = v_total*.9
    v_total = v_total.toFixed(2)
    // return total
    if (v_total < 250) v_total = "250.00";
    f.Total.value = v_total
    
    
    }
    </script>
    Houston Brown
    Split Light Designs
    Bringing your ideas to light.

  4. #4
    SitePoint Guru htown's Avatar
    Join Date
    Mar 2005
    Posts
    661
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hello !!!

    Anyone ......

    Please......Help......


    Houston Brown
    Split Light Designs
    Bringing your ideas to light.

  5. #5
    &#083;itePoint Aficionado JVLB's Avatar
    Join Date
    Jan 2002
    Location
    N 44 56.537' W 123 3.683'
    Posts
    1,127
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The frameset code has to come from somewhere; Firefox can't create it. The page within the frame would have different code and would not appear particularly frame oriented, but is being loaded into a frame for display.

    If you put an alert before the //calculate result section that has alert(v_item+'\n'+v_wt) does IE fire the alert and if so, what are the values?

  6. #6
    SitePoint Guru htown's Avatar
    Join Date
    Mar 2005
    Posts
    661
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    OK, I swear I am not loosing my mind. When I go and try to validate the page it says it is trying to validate STRICT when the DOCTYPE is actually 1.0 Transitional. I am assuming this is because of the FRAME that is supposedly there.

    I agree with you that FF is not putting in a Frame but when I run the page locally in FF and right click the mouse, there is no option to select source in "This Frame" which means there is no frame. The same exact page, and I have confirmed that it is the same page (same code), and I right click, it thinks there is a frame. When I do a display source in IE it displays the source for the page perfectly. It does not seem to see a frame. Even when I search in my entire web site in my HTML editor, I find no occurrence of FRAMESET. I have deleted all the files on the remote server and re-uploaded them, still having the problem. This is blowing my mind. I am obviously missing something crucial here.

    I feel like this needs to be fixed before the original issue can be approached because this is just to weird and who knows what problems it could be causing.

    Thoughts?
    Houston Brown
    Split Light Designs
    Bringing your ideas to light.

  7. #7
    SitePoint Addict jtrelfa's Avatar
    Join Date
    Oct 2004
    Location
    Troy, Mi
    Posts
    231
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Here's what I'm seeing -

    http://www.texasmovepro.com/quotesheet.html

    Contains a frameset that points to a different URL:

    http://www.txmover.com/quotesheet.html

    These are two different domains - so you *may* have issues with cross-domain scripting.

    I'm taking a look at your code to see why it does(n't) work in IE - but I'm at work and can't guarantee a quick response. I'll get back to you today, though.

  8. #8
    &#083;itePoint Aficionado JVLB's Avatar
    Join Date
    Jan 2002
    Location
    N 44 56.537' W 123 3.683'
    Posts
    1,127
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It is important to find the values I mentioned; if one is staying at 0, then the result of the multiplication is 0. It will be necessary to back track to find where IE is losing it.

    There are really only two possibilities here: IE is not making it to the answer or it's producing an answer, it's just not the one you expect. Until we determine which it is, we have nothing to go on.

    When you work with the local page, you are working with the page that goes in the frame. Since it sounds like the code is on the same page as it effects, I pretty much doubt that cross-site issues are to blame.

  9. #9
    SitePoint Guru htown's Avatar
    Join Date
    Mar 2005
    Posts
    661
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    jtrelfa, It seems that when you forward a domain name the simple way, it wraps the new one in a frameset that is generated by a script. This has not been a problem in the past with the script. What I do not like about this is the page will not validate going through texasmovepro.com because the doctype is strict. Not that big a deal, but I am going to see if the other hosting company has domain name aliasing so I can bypass this. Another issue not having to do with this at all, or at least I think not.

    Cheers
    Houston Brown
    Split Light Designs
    Bringing your ideas to light.

  10. #10
    SitePoint Guru htown's Avatar
    Join Date
    Mar 2005
    Posts
    661
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    JVLB, I put in the code but IE just blew right past it. It is still in there if you want to take a look and make sure I did it right.

    Cheers
    Houston Brown
    Split Light Designs
    Bringing your ideas to light.

  11. #11
    &#083;itePoint Aficionado JVLB's Avatar
    Join Date
    Jan 2002
    Location
    N 44 56.537' W 123 3.683'
    Posts
    1,127
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I looked, but didn't see the alert. If the alert doesn't appear in IE, but does in FF, it means IE doesn't make it to that point in the script.

  12. #12
    SitePoint Guru htown's Avatar
    Join Date
    Mar 2005
    Posts
    661
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I am sorry but I had to take it out. I was trying to show the client that the form test to make sure the required fields did work. So I left the form blank and hit CALCULATE and the alert popped up but went into some vicious cycle that I could not get out of so I had to remove it.

    I will put it back in tomorrow. It is quiting time now. I was going to go and have my hair cut, but now I have none to cut.

    Thanks again. I will let you know when it is back in.

    Cheers
    Houston Brown
    Split Light Designs
    Bringing your ideas to light.

  13. #13
    &#083;itePoint Aficionado JVLB's Avatar
    Join Date
    Jan 2002
    Location
    N 44 56.537' W 123 3.683'
    Posts
    1,127
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I assume the vicious cycle occurred after you dismissed the popup. Could you describe the symptoms, because this is pretty unusual. All an alert should do pause execution and display the alert. This suggests there are simultaneous threads of execution, the timing of which plays out okay in FF, but not IE. Anything we try should be tested in both browsers and results noted.

    Also, please report the values that were displayed in the alert, both in FF and IE.
    Last edited by JVLB; Jan 5, 2007 at 09:22.


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
  •