Re: rich text editing



great !! it works thanks !!!! I think I was doing almost the same, i
think the difference is that i was using iframe.src = "newlocation"
and you are using the setAttribute method =)

thanks !!!

BTW, is it possible to have an empty iframe (withou any src property)
and change its contents with innerHTML or something ?


On Aug 23, 4:21 pm, elephant <matt.mi...@xxxxxxxxx> wrote:
why does this works ...

I'm not positive why the second doesn't work, but, I think it's
because design mode needs to be run after the area loads

PS in case you are wondering, it is important for me to change
dinamically the src field of the iframe ... btw, is this possible ?

Yep, here you go

<script type='text/javascript'>
function changeSrc(newUrl) {
document.getElementById('myframe').setAttribute('src',
newUrl);
}
function designModeOn(sentIframe) {
sentIframe.contentDocument.designMode = "On";
}
</script>
<body>
<iframe id='myframe' src='deleteMe.html'
onload='designModeOn(this)'></iframe>
<button onclick='changeSrc("test.html");' />
</body>

Customize to fit your needs,


.



Relevant Pages

  • Re: changing iframe src, whats the best way
    ... Gecko derived browsers) and opera versions from 6 on, ... The src property is only used to set the initial url of the Iframe. ... The most general, cross-browser, method of navigating any frame ...
    (comp.lang.javascript)
  • Re: cancelling keydown event in designmode(rich text editing) in firefox
    ... No keystrokes at all are passed on to the iframe, ... BTW your code is very hard to read/debug. ... intercepting the enter key and trying to duplicate what browsers do ... Dreadfull code. ...
    (comp.lang.javascript)
  • Re: General DHTML question about ID
    ... alert -> ... so what i want to say is, i can only set the src property of an iframe ... without even the implied warranty of merchantability ...
    (microsoft.public.scripting.jscript)
  • Re: changing iframe src, whats the best way
    ... using the setAttribute method. ... I'll only need to be doing this on the 21st century browsers (IE6+, ... The src property is only used to set the initial url of the Iframe. ... I should have specified that the iframe was created with no src property in the iframe tag, so it's debatable whether what I'd be doing would meet your classification of "initial url". ...
    (comp.lang.javascript)
  • Re: Loading response into Iframe
    ... Here is a short article that shows how to manipulate an IFRAME server side, set the src property, etc: ... I have retrieved a page response from a server like: ... I need to put the resultant page into the iframe as the src, But cant figure out how to do it. ...
    (microsoft.public.dotnet.languages.csharp)