1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.
  2. Better Analytics for WordPress Get It Free

IE no like innerHTML? FF does...

Discussion in 'JavaScript' started by GoldDog, May 16, 2005.

  1. #1
    Can anyone tell me why IE doesn't like this script?

    My function looks like this...

    
    var c = 0;
    function reCalc(i) {
    	c = 10*i;
    	document.getElementById('subT').innerHTML = c;
    }
    
    PHP:
    ...and the call to the function looks like this...

    
    <select name="qty" onchange="reCalc(this.value)">
    
    PHP:
    ...and the page element 'subT' looks like this...

    
    $<span id="subT">275</span>
    
    PHP:
    In Mozilla subT gets rewritten to reflect the math requested in the function, but IE insists on setting the value of subT to 0 every time.

    Any ideas? Thanks
     
    GoldDog, May 16, 2005 IP
  2. frankm

    frankm Active Member

    Messages:
    915
    Likes Received:
    63
    Best Answers:
    0
    Trophy Points:
    83
    #2
    GD, your problem is not the innerHTML, but the onchange.

    onchange="f(this.value);" does not work in IE.
    you should use something like:
    si = document.forms.form1.qty.selectedIndex;
    if (si > 0)
    {
    v = document.forms.form1.qty.options[si].value;
    }

    but that's from the top of my head :)
     
    frankm, May 16, 2005 IP
  3. GoldDog

    GoldDog Peon

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    That was it. Thanks frankm
     
    GoldDog, May 16, 2005 IP