//создаём iframe var iframe = document.createElement("iframe"); //определяем его параметры iframe.frameBorder=0; iframe.frameMargin=0; iframe.framePadding=0; iframe.height=200; //определяем класс uframe if(textarea.attr('class')) iframe.className = textarea.attr('class'); //определяем id iframe if(textarea.attr('id')) iframe.id = textarea.attr('id'); //определяем имя iframe if(textarea.attr('name')) iframe.title = textarea.attr('name'); //присоединяем iframe к textarea textarea.after(iframe); //определяем контект iframe var css = "<link type='text/css' rel='stylesheet' href='"+css_url+"' />"; var content = textarea.val(); var doc = "<html><head>"+css+"</head><body class='frameBody'>"+content+"</body></html>"; //заносим контент в iframe iframe.contentWindow.document.open(); iframe.contentWindow.document.write(doc); iframe.contentWindow.document.close(); //Выставляем режим редактирования объектов if (document.contentEditable) { iframe.contentWindow.document.designMode = "On"; } //атачим картинку в iframe iframe.contentWindow.document.execCommand('InsertImage', false, 'я_картинко.джпг');