bueno tengo este codigo
Código PHP:
<script language="javascript">
function CreaObjSwf() {
var ElObjtInEr=document.createAttribute('div');
ElObjtInEr.appendChild(document.createTextNode('Texto Que tiene que aparecer en un nuevo Div'));
return ElObjtInEr;
}
function reemplazar(textarea){
var nuevoSWF=CreaObjSwf();
if(typeof textarea == 'string') textarea = document.getElementById(textarea); //Obtenemos el elemento textarea
var div= document.createElement('div'); //Creamos un div sin nada
div.style.width = textarea.offsetWidth+'px'; //Ajustamos la anchura
div.style.height = textarea.offsetHeight+'px'; //Ajustamos la altura
div.style.border = '1px solid red'; //Solo para poder verlo..
textarea.parentNode.replaceChild(div,textarea); //Reemplazamos el textarea
div.appendChild(nuevoSWF)
};
</script>
la cuestión de todo esto es que el código realmente lo tengo asi
Código PHP:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Editor Cfx</title>
</head>
<script language="javascript">
var isIE = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;
function CreaParam(objCont,params){
for (i=0;i<params.length;i=i+2){
var newParm=document.createElement('param');
newParm.name=params[i];
newParm.value=params[i+1];
objCont.appendChild(newParm);
}
}
function ValoresExt(src, ext)
{
if (src.indexOf('?') != -1)
return src.replace(/?/, ext+'?');
else
return src + ext;
}
function CreaObjSwf(nombre,dir, ancho , alto )
{
dir=ValoresExt(dir, 'swf');
if (isIE && isWin && !isOpera)
{
var ElObjtIn=document.createElement('object');
ElObjtIn.classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" ;
ElObjtIn.codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" ;
ElObjtIn.width=ancho;
ElObjtIn.height=alto ;
ElObjtIn.id="CfxEditorObj";
ElObjtIn.align="middle";
var ElementParam=new Array(
"allowScriptAccess" ,"sameDomain",
"allowFullScreen", "false",
"movie", dir,
"quality","high",
"bgcolor" , "#000000"
);
CreaParam(ElObjtIn,ElementParam);
var str=document.createElement('embed');
str.src=dir;
str.quality="high";
str.bgcolor="#000000" ;
str.width=ancho ;
str.height=alto ;
str.name=nombre ;
str.align="middle" ;
str.allowScriptAccess="sameDomain";
str.allowFullScreen="false" ;
str.type="application/x-shockwave-flash";
str.pluginspage="http://www.macromedia.com/go/getflashplayer" ;
return ElObjtIn;
}else{
ElObjtInEr=document.createAttribute('div');
ElObjtInEr.appendChild(document.createTextNode('Navegador no Compatible Con CfxEditor'));
return ElObjtInEr;
}
}
function reemplazar(textarea){
var nuevoSWF=CreaObjSwf('editorCfx','editorCfx',500,600);
if(typeof textarea == 'string') textarea = document.getElementById(textarea); //Obtenemos el elemento textarea
var div= document.createElement('div'); //Creamos un div sin nada
div.style.width = textarea.offsetWidth+'px'; //Ajustamos la anchura
div.style.height = textarea.offsetHeight+'px'; //Ajustamos la altura
div.style.border = '1px solid red'; //Solo para poder verlo..
textarea.parentNode.replaceChild(div,textarea); //Reemplazamos el textarea
div.appendChild(nuevoSWF)
};
</script>
<body>
<p>
<textarea id="tes" name="texto" cols="50" rows="20"></textarea>
<input name="Boton" type="button" value="Boton" onclick="reemplazar('tes');"/>
</body>
</html>
PD:Me pueden recomendar un buen programa de JavaScrit donde tenga un debug del código porque asi estoy dando pasos de ciego XDXD