Design Mode implementation, misc problems

Discussion in 'Javascript' started by AaronNGray, Dec 24, 2009.

  1. AaronNGray

    AaronNGray Guest

    Hi,

    I have created a minimized DesignMode test, that works accross all the
    main browsers AFAICT and on IE5, 6, 7, and 8.

    I have two problems on IE :-

    - the first is IE insists on putting a borderframe on the iframe
    window, even though I have fameborder set to "no".

    - second, is focus, IE does not give the iframe focus until the mouse
    cursor goes over the window.

    Here's my code :-

    http://www.aarongray.org/comp.lang.javascript/DesignMode/Edit.html

    ~~~~
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
    <script>

    window.onload = Init;

    function Init() {
    var f = document.createElement("iframe");
    f.id = "editableiframe";
    f.className = "editable";
    f.style.border = "solid 1px black"
    f.frameborder = "no";
    f.setAttribute("frameborder", "no");

    document.body.appendChild(f);

    f.contentWindow.document.open();
    f.contentWindow.document.write("<html><body>tester</body></html>");
    f.contentWindow.document.close();

    f.contentWindow.document.designMode = "on";

    f.contentWindow.focus();
    }

    </script>
    </head>
    <body>
    </body>
    </html>
    ~~~~

    Many thanks in advance,

    Aaron
     
    AaronNGray, Dec 24, 2009
    #1
    1. Advertising

  2. AaronNGray

    Evertjan. Guest

    AaronNGray wrote on 24 dec 2009 in comp.lang.javascript:

    > Hi,
    >
    > I have created a minimized DesignMode test, that works accross all the
    > main browsers AFAICT and on IE5, 6, 7, and 8.
    >
    > I have two problems on IE :-
    >
    > - the first is IE insists on putting a borderframe on the iframe
    > window, even though I have fameborder set to "no".
    >
    > - second, is focus, IE does not give the iframe focus until the mouse
    > cursor goes over the window.
    >
    > Here's my code :-
    >
    > http://www.aarongray.org/comp.lang.javascript/DesignMode/Edit.html
    >
    > ~~~~
    > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    > <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    > <head>
    > <script>
    >
    > window.onload = Init;
    >
    > function Init() {
    > var f = document.createElement("iframe");
    > f.id = "editableiframe";
    > f.className = "editable";
    > f.style.border = "solid 1px black"
    > f.frameborder = "no";


    frameBorder


    > f.setAttribute("frameborder", "no");
    >
    > document.body.appendChild(f);
    >
    > f.contentWindow.document.open();
    > f.contentWindow.document.write("<html><body>tester</body></html>")
    > ; f.contentWindow.document.close();
    >
    > f.contentWindow.document.designMode = "on";
    >
    > f.contentWindow.focus();
    >}
    >
    > </script>
    > </head>
    > <body>
    > </body>
    > </html>
    > ~~~~
    >
    > Many thanks in advance,
    >
    > Aaron
    >




    --
    Evertjan.
    The Netherlands.
    (Please change the x'es to dots in my emailaddress)
     
    Evertjan., Dec 24, 2009
    #2
    1. Advertising

  3. AaronNGray

    AaronNGray Guest

    On 24 Dec, 12:41, "Evertjan." <> wrote:
    > AaronNGray wrote on 24 dec 2009 in comp.lang.javascript:
    >
    >
    >
    > > Hi,

    >
    > > I have created a minimized DesignMode test, that works accross all the
    > > main browsers AFAICT and on IE5, 6, 7, and 8.

    >
    > > I have two problems on IE :-

    >
    > > - the first is IE insists on putting a borderframe on the iframe
    > > window, even though I have fameborder set to "no".

    >
    > > - second, is focus, IE does not give the iframe focus until the mouse
    > > cursor goes over the window.

    >
    > > Here's my code :-

    >
    > >    http://www.aarongray.org/comp.lang.javascript/DesignMode/Edit.html

    >
    > > ~~~~
    > > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    > > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    > > <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    > > <head>
    > > <script>

    >
    > > window.onload = Init;

    >
    > > function Init() {
    > >     var f = document.createElement("iframe");
    > >     f.id = "editableiframe";
    > >     f.className = "editable";
    > >     f.style.border = "solid 1px black"
    > >     f.frameborder = "no";

    >
    > frameBorder
    >
    >
    >
    > >     f.setAttribute("frameborder", "no");

    >
    > >     document.body.appendChild(f);

    >
    > >      f.contentWindow.document.open();
    > >      f.contentWindow.document.write("<html><body>tester</body></html>")
    > >      ; f.contentWindow.document.close();

    >
    > >     f.contentWindow.document.designMode = "on";

    >
    > >     f.contentWindow.focus();
    > >}

    >
    > > </script>
    > > </head>
    > > <body>
    > > </body>
    > > </html>
    > > ~~~~

    >
    > > Many thanks in advance,

    >
    > > Aaron

    >
    > --


    Evertjan,

    Nice thanks for that, glad it something simple :)

    Aaron
     
    AaronNGray, Dec 24, 2009
    #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. .
    Replies:
    0
    Views:
    630
  2. John J Lee
    Replies:
    3
    Views:
    550
    bruno at modulix
    Dec 1, 2005
  3. jacko

    MISC CPU Design

    jacko, Aug 21, 2006, in forum: VHDL
    Replies:
    1
    Views:
    843
    jacko
    Aug 25, 2006
  4. Edward Loper
    Replies:
    0
    Views:
    523
    Edward Loper
    Aug 7, 2007
  5. John J Lee
    Replies:
    0
    Views:
    558
    John J Lee
    Aug 7, 2007
Loading...

Share This Page