Code works with IE7, FF3.5 but not IE8 and Why?

Discussion in 'Javascript' started by DL, Apr 21, 2010.

  1. DL

    DL Guest

    ....
    <script type="text/javascript">

    function setFrm() {
    var fh = document.getElementById('txt');
    fh.style.width = (screen.width - 60);
    fh.style.height = (screen.height - 330);
    }

    </script>
    ....
    <body onload="setFrm();">
    ....
    <iframe id="txt" name="txt" contenteditable="true"></iframe>

    OUTCOME: the above is working across IE7/8 and Firefox3.5.

    <img onclick="var x =
    frames['txt'].document.selection.createRange();x.execCommand('InsertOrderedList');x.select();"
    src="icons/list_ordered.gif" style="valign:bottom;width:25;height:
    20" />

    OUTCOME: the above Ordered List function is not working with IE8 while
    it works with both IE7 and Firefox3.5, specifically, upon click,
    order number goes out of the iframe instead of being inside,
    how come? How can we fixt it?

    (I understand when the Style of Width and Height for the iframe is set
    within the iframe element, this is not an issue but I'd like to set
    the iframe's width and height dynanically).

    Thanks in advance.
     
    DL, Apr 21, 2010
    #1
    1. Advertising

  2. DL

    Joe Nine Guest

    DL wrote:
    > <script type="text/javascript">
    >
    > function setFrm() {
    > var fh = document.getElementById('txt');
    > fh.style.width = (screen.width - 60);
    > fh.style.height = (screen.height - 330);
    > }
    >
    > </script>



    You need to add "px" to it.

    fh.style.width = (screen.width - 60)+"px";
    fh.style.height = (screen.height - 330)+"px";
     
    Joe Nine, Apr 21, 2010
    #2
    1. Advertising

  3. DL

    DL Guest

    On Apr 21, 10:47 am, Joe Nine <> wrote:
    > DL wrote:
    > > <script type="text/javascript">

    >
    > > function setFrm() {
    > >    var fh = document.getElementById('txt');
    > >                    fh.style.width = (screen.width- 60);
    > >                    fh.style.height = (screen.height - 330);
    > >    }

    >
    > > </script>

    >
    > You need to add "px" to it.
    >
    > fh.style.width = (screen.width - 60)+"px";
    > fh.style.height = (screen.height - 330)+"px";



    Great catch. I just did, still to no avail (same problem). What else
    could we try? Thanks.
     
    DL, Apr 21, 2010
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mr. SweatyFinger
    Replies:
    2
    Views:
    2,131
    Smokey Grindel
    Dec 2, 2006
  2. Eris of Stronghold [STRM]

    Absolute Image Positioning in FF3.5 vs IE8

    Eris of Stronghold [STRM], Oct 1, 2009, in forum: HTML
    Replies:
    1
    Views:
    971
  3. Jean-Fabrice RABAUTE
    Replies:
    0
    Views:
    106
    Jean-Fabrice RABAUTE
    Mar 20, 2008
  4. DL
    Replies:
    13
    Views:
    184
  5. cecile

    ie8!=ie8

    cecile, May 24, 2010, in forum: Javascript
    Replies:
    2
    Views:
    206
    David Mark
    May 24, 2010
Loading...

Share This Page