Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > designMode on an iframe - relocating images in the dom and keeping their focus

Thread Tools

designMode on an iframe - relocating images in the dom and keeping their focus
Posts: n/a
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.

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Disable default dragging/resizing behaviours in iframe with designMode="on" Sammy Javascript 0 01-20-2006 10:30 PM
problems with iframe inside another iframe (with designMode="on") Javascript 0 01-19-2006 12:28 AM
Is Capturing keypress in a designMode IFrame possible? Jay Xx Javascript 4 03-12-2005 02:40 PM
iframe.onfocus witn designMode="On" Pilu Javascript 0 02-16-2005 04:25 AM
After the execution of frame.iframe.document.designMode="On" , I lost the access to iframe, it says permission denied Javascript 0 07-17-2003 05:05 AM