contentEditable in firefox?

Hi,

I have a div section with contentEditable = true. Everything works great in IE, however in firefox i cannot edit any text in the div. What do I need to change for firefox to be happy? Below is the full page:

<html>
<head>
<script>
function FindLink()
{
     var dc = document.getElementById("chip1").getElementsByTagName("A");
     for (i=0;i<dc.length;i++) {
          dc[i].onclick = new Function("window.open(this,this.id,''); return false;");
     }
}
</script>
</head>
<body>

<div onmouseover="FindLink()"  id = "chip1" contentEditable = false style = "left: 134px; overflow:scroll; width:188px; border-top-style:inset; border-right-style:inset; border-left-style:inset; position:absolute; top:75px; height:125px; border-bottom-style:inset">
<b>hello</b>
<Font color=red>Hi Again!</font>

<a href="http://www.something.com">www.something.com</a>
</div>

</body>
</html>
LVL 7
minnirokAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

KennyTMCommented:
Hi.

Firefox does not support contentEditable, but it supports designMode which might suit your need. Only that you'll need to use <iframe> instead of <div>.

You can check http://www.mozilla.org/editor/ie2midas.html for detail.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
minnirokAuthor Commented:
Ok if I have to use iframes that's fine, but will that work in IE as well? Do you have an example you can post of this working in both browsers?

Thanks
0
KennyTMCommented:
Well, in fact "designMode" is supported in IE (http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/reference/properties/designmode.asp), so if you just want the section to be editable, this is enough:


<body onload="document.getElementById('the_iframe').contentWindow.document.designMode = 'on';">
                       <!-- to activate edit mode -->
...
<iframe src="about:blank" id="the_iframe" />

But if you want to script it also, browser incompatibility involves.
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

minnirokAuthor Commented:
Hi Kenny,

So what's the difference exactly between designMode and contentEditable ?

All I want to be able to do is let the user type some text into the div, then if they type a URL like www.hello.com, have it be hilighted and they can click on it.

Can 'designMode' do that with the iFrames for both IE and FF?

Sorry for my confusion,

Thanks
0
KennyTMCommented:
designMode can only be applied to a "document" (e.g. a frame / iframe), and contentEditable can almost be applied in any tags. But contentEditable is IE-only.

And if you follow http://www.mozilla.org/editor/ie2midas.html ,  it should be able to support both IE & Fx.
0
minnirokAuthor Commented:
Hi Kenny,

I'm a little worried, I followed the link and then tried their demo:

http://www.mozilla.org/editor/midasdemo/

Now, in IE a 'link' will auto hilight (like www.whatever.com), but the same page run in firefox does absolutely nothing after you've typed a URL in the text field.... am I missing something? Is it even supposed to auto-hilight for firefox?

Thanks
0
KennyTMCommented:
Yes, Firefox doesn't support auto-highlight. You'll need to program that yourself...
0
minnirokAuthor Commented:
Oh dear. Ok, I will have to open a new question for that then.

Thanks!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
HTML

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.