codetoad.com
Home||ASP|ASP.Net|C++/C#|DHTML|HTML|Java|Javascript|Perl|VB|XML||CodeToadPlus!||Forums||RAM
Search Site:
Search Forums:
one showModalDialog html editor file`s IFRAME can not edit dudie at 02:12 on Monday, September 29, 2003

I have a html with one button,when clicking a showModalDialog html popup which is a web text editor, in the popup html, there is a IFRAME,i use the IFRAME to save the editting text. All function will be ok in the IE5.
but in ie5.5 or lator, the IFRAME can not edit.if i use a div instead of IFRAME, it can not run on IE5.0.

here is the test html

<SCRIPT LANGUAGE=JavaScript>
function multi_edit() {
var arr = showModalDialog("editor.html?time=1063664813174", "", "dialogWidth:40em; dialogHeight:30em; status:0");

}
</SCRIPT>
<input type=button name=test value=test onclick="multi_edit()">

here is the editor html


html>
<head>
<title>ͼÎÄ»ìÅÅ</title>

<meta http-equiv=Content-Type content="text/html; charset=gb2312">

</head>

<body bgcolor=menu onload="InitDocument();" STYLE="margin:0pt;padding:0pt">

<input type="hidden" name="HtmlText" value='hdsfdffsd'>



<IFRAME class="Composition" ID="Composition"
MARGINHEIGHT="1" MARGINWIDTH="1" width="100%" height="320">
</IFRAME>

<script LANGUAGE="Javascript">
var bodyTag="<head><style type=\"text/css\">body {font-size: 10.8pt}</style><meta http-equiv=Content-Type content=\"text/html; charset=gb2312\"></head><BODY bgcolor=\"#FFFFFF\" MONOSPACE>"
+ document.all("HtmlText").value;

var isHTMLMode = false

function document.onreadystatechange() {
Composition.document.designMode="On";
}


function InitDocument()
{
document.designMode="On";
Composition.document.open();
Composition.document.write(bodyTag);
Composition.document.designMode="On";

// Composition.document.close();
Composition.focus();
// setTimeout("Composition.focus()",0);

}

</script>

<table>
<tr>
<td width="100%" bgcolor="#CCCCCC" align="right">
<input type="button" value="È· ¶¨" name="Ok">
<input type="button" value="È¡ Ïû" name="Cancel" onclick="window.close();">
</td>
</tr>
</table>

</body>
</html>

pls. help me




Re: one showModalDialog html editor file`s IFRAME can not edit dudie at 02:00 on Tuesday, September 30, 2003

any one can help me

Re: one showModalDialog html editor file`s IFRAME can not edit maali at 09:53 on Tuesday, October 14, 2003

I get an error with your code in IE5.0... ;)
I delete line
document.designMode="On";
and then, it was ok.

To write code into iframe, i don't do it like you :

var sel =
myiframename.document.selection.createRange;
sel().pasteHTML(myTxtHtml);

where "myTxtHtml" does not contain head and body, but only content, because iframe has already a default body tag. (try myiframe.document.body.innerHTML to view iframe content).

I get the selection in iframe (if there is no selection, it will insert at the beginning of iframe), and then use pasteHTML function which is only for IE, but it seems that you only want your editor for IE.

Re: one showModalDialog html editor file`s IFRAME can not edit dudie at 02:00 on Wednesday, October 15, 2003

Thanks for your reply. I am a newer for dhmtl, so could you paste your code. I can not understand your reply. My target is that a web editor pops up by pressing a showModalDialog button, and it will run ok on ie 5.0 or lator.
thanks

<Added>

when the editor popup, the user can write some formmatted text in it, like MS word.

Re: one showModalDialog html editor file`s IFRAME can not edit maali at 08:20 on Wednesday, October 15, 2003

Hi,

i think you can't do this in a showModalDialog. This type of popup is not like a real window.
I tried your code with a window.open and it worked on IE6 and IE5.

Why are you using a showModalDialog?

if you want to get the content of iframe in window opener, you can do it like this :

for example : window.opener.arr = myiframe.document.body.innerHTML;

I can't send my code, sorry, but i'm ready to help you.
I hope you will understand this post :)

Bye

Alice



Re: one showModalDialog html editor file`s IFRAME can not edit dudie at 01:50 on Thursday, October 16, 2003

Thanks you very much. Yes, I can do like that. But i want to know why the showModalDialog html editor work ok in the ie5.0, and not ok in ie5.5 or lator.

Re: one showModalDialog html editor file`s IFRAME can not edit maali at 06:39 on Thursday, October 16, 2003

I really don't know it is like that...
But i have seen many things in IE who have not the same behvaior between two versions IE5, IE5.5 and IE6! And it was not because the new behavior was better!

Bye

Alice


Re: one showModalDialog html editor file`s IFRAME can not edit jcamburn at 00:01 on Friday, December 05, 2003

document.designMode = "On" worked for IE 5.

document.body.contentEditable = "True" works in IE 5.5.

for example, try:



<html>
<head>
<SCRIPT LANGUAGE=javascript>
function window_onload() {
textEdit.document.body.contentEditable = "True"; //This line works in Internet Explorer 5.5,
// but not in Internet Explorer 5.
textEdit.document.designMode="On"; //This line works in Internet Explorer 5,
// but not in Internet Explorer 5.5.
textEdit.focus();
}
</SCRIPT>
</head>
<body onload="return window_onload()" language="javascript">
<iframe name="textEdit" id="textEdit" width="400" height="280"></iframe>
</body>
</html>









CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums
//








Recent Forum Threads
`section` is an unexpected token. Expecting white space. Line 1, position 137.
Javascript rollover toggle help please!
help monitoting cpu load on windows machine
Re: convert aspx page to pdf
Accessing .htc file
Access binary data from http
Inserting checkbox values into one field
Silverlight or ASPX ?
Export to excel


Recent Articles
ASP GetTempName
Decode and Encode UTF-8
ASP GetFile
ASP FolderExists
ASP FileExists
ASP OpenTextFile
ASP FilesystemObject
ASP CreateFolder
ASP CreateTextFile
Javascript Get Selected Text


Copyright codetoad.com 2001-2009