Stig Johansen wrote in dk.edb.internet.webdesign.clientside:
> "Anders M" <asdsda@dsasad.com> wrote in message
> news:4b1d6e77$0$281$14726298@news.sunsite.dk...
> >
> > Jeg skal hente en TinyMCE editor i en ajax funktion.. dvs. at det skal
> køres
> > NÅR ajax funktion er færdig.
>
> Jeg har det lidt ligesom Birger, med jeg ikke rigtig forstår hvor du vil
> hen.
> TinyMCE er jo bare noget javascript, der bygger en redigerbar iframe ud fra
> et textarea.
>
> Den ligger vel som <script src=".. osv i din head sektion ?
>
> TinyMCE kan du formentlig 'aktivere' i din callback funktion.
>
> Det er jo her du *ved* at ajaxfunktionen er færdig (og ok).
>
> --
> Med venlig hilsen/Best regards
> Stig Johansen
Jeg har fundet ud af det nu, men der er opstået et underligt problem. FF
plejer altid at køre "alt" uden brok, men det modsatte viste sig i dag, da jeg
lavede dette:
var xmlhttp;
function loadfile(filename, filetype)
{
switch(filetype)
{
case "js":
var file = document.createElement('script')
file.setAttribute("type","text/javascript")
file.setAttribute("src", filename)
break;
case "css":
var file=document.createElement("link")
file.setAttribute("rel", "stylesheet")
file.setAttribute("href", filename)
file.setAttribute("type", "text/css")
break;
}
if (typeof file!="undefined")
document.getElementsByTagName("head")[0].appendChild(file)
}
function dialog(url)
{
xmlhttp = GetXmlHttpObject();
if (xmlhttp==null)
{
alert ("Browser does not support HTTP Request");
return;
}
var url = url;
url = url+"&sid=" + Math.random();
xmlhttp.onreadystatechange = function() {
// only if req shows "loaded"
if (xmlhttp.readyState == 4) {
// only if "OK"
if (xmlhttp.status == 200)
{
var browser = navigator.appName;
if (browser=="Microsoft Internet Explorer")
{
document.getElementById("body").className = "shadow";
document.getElementById("top").className = "shadow";
document.getElementById("bottom").className = "shadow";
document.getElementById("menu").className = "shadow";
}
else
{
document.getElementById("agmweb_cms").className = "shadow";
}
document.getElementById("dialog").innerHTML = xmlhttp.responseText;
}
else
{
dialog("/admin/dialogs/error.php?error="+xmlhttp.statusText);
}
}
}
xmlhttp.open("GET",url,true);
xmlhttp.send(null);
}
function dialog_tinymce(url)
{
xmlhttp = GetXmlHttpObject();
if (xmlhttp==null)
{
alert ("Browser does not support HTTP Request");
return;
}
var url = url;
url = url+"&sid=" + Math.random();
xmlhttp.onreadystatechange = function() {
// only if req shows "loaded"
if (xmlhttp.readyState == 4) {
// only if "OK"
if (xmlhttp.status == 200)
{
var browser = navigator.appName;
if (browser=="Microsoft Internet Explorer")
{
document.getElementById("body").className = "shadow";
document.getElementById("top").className = "shadow";
document.getElementById("bottom").className = "shadow";
document.getElementById("menu").className = "shadow";
}
else
{
document.getElementById("agmweb_cms").className = "shadow";
}
document.getElementById("dialog").innerHTML = xmlhttp.responseText;
loadfile("/admin/plugins/tinymce/jscripts/tiny_mce/tiny_mce.js", "js")
//dynamically load and add this .js file
tinyMCE.init({
// General options
mode : "textareas",
theme : "advanced",
plugins :
"safari,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespe
ll,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,p
aste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,
template,wordcount",
relative_urls : false,
// Theme options
theme_advanced_buttons1 :
"save,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justif
yright,justifyfull,styleselect,formatselect,fontselect,fontsizeselect",
theme_advanced_buttons2 :
"cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outde
nt,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,
|,insertdate,inserttime,preview,|,forecolor,backcolor",
theme_advanced_buttons3 :
"tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespel
l,media,advhr,|,print,|,ltr,rtl,|,fullscreen",
theme_advanced_buttons4 :
"insertlayer,moveforward,movebackward,absolute,cite,abbr,acronym,del,ins,attri
bs,|,visualchars,nonbreaking,pagebreak",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
theme_advanced_statusbar_location : "bottom",
theme_advanced_resizing : true,
// Example content CSS (should be your site CSS)
content_css : "",
// Drop lists for link/image/media/template dialogs
external_link_list_url : "/admin/plugins/tinymce/list/links.php",
file_browser_callback : "myFileBrowser"
});
}
else
{
dialog("/admin/dialogs/error.php?error="+xmlhttp.statusText);
}
}
}
xmlhttp.open("GET",url,true);
xmlhttp.send(null);
}
function close_dialog()
{
var browser=navigator.appName;
if (browser=="Microsoft Internet Explorer")
{
document.getElementById("body").className = "";
document.getElementById("top").className = "";
document.getElementById("bottom").className = "";
document.getElementById("menu").className = "";
}
else
{
document.getElementById("agmweb_cms").className = "";
}
document.getElementById("dialog").innerHTML = "";
}
Internet Explorer viser dialogen fint, og henter TinyMCE ved dialog_tinymce,
men det virker ikke i FF.. hvordan kan det være? Er det noget med at den kører
i layers?
Mvh Anders
--
Vil du lære at kode HTML, XHTML, CSS, SSI, ASP eller ASP.NET?
- Pædagogiske tutorials på dansk
- Kom godt i gang med koderne
KLIK HER! =>
http://www.html.dk/tutorials