designMode on an iframe - relocating images in the dom and keeping their focus

Discussion in 'Javascript' started by, Jan 1, 2007.

  1. Guest

    I'm using designMode on an iframe to create a simple html editor, based
    on widgEdit from

    I've added toolbar buttons that let you nudge an image up and down the
    dom tree. You click on an image in the design view and then press the
    buttons to move the image up or down through the paragraphs. Behind the
    scenes when the button is pressed I create a duplicate of the image
    node, delete it from where it is and locate the previous or next block
    level element and append the duplicated image to that new parent node.

    This works ok and the image moves up or down as you'd expect.

    The problem is that I want to give the new image focus once it has been
    relocated. In firefox the focus indicators remain in the old position
    where the image used to be. It's selecting the image which is no longer
    there, this is wrong. So when I press the "move image upwards" button a
    second time, the newly positioned image isn't in focus and nothing
    happens, you have to manually refocus on the image again (by clicking
    on it) once it has been moved.

    In IE the focus indicators correctly vanish.

    By "focus indicators" I mean the 8 draggable nodes that appear around
    the image so that it can be resized.

    In both browsers I can't give the newly positioned image focus. After
    the button has been pressed I want the newly positioned image to have
    the "focus indicators". The idea is that the user can keep pressing the
    nudge up/down buttons to move the image to wherever they want it to be.

    I have tried oImage.focus(), Nothing seems to work.

    Can anybody tell me how to do this?

    I can put an example online if you want.
    , Jan 1, 2007
    1. Advertisements

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:
  2. Pilu
  3. Jay  Xx
    Martin Honnen
    Mar 12, 2005
  4. Replies:
  5. Sammy
    Jan 20, 2006

Share This Page