Ver Mensaje Individual
  #2 (permalink)  
Antiguo 09/09/2011, 16:38
Avatar de JuJoGuAl
JuJoGuAl
 
Fecha de Ingreso: julio-2009
Ubicación: Venezuela
Mensajes: 754
Antigüedad: 15 años, 4 meses
Puntos: 19
Respuesta: error de ejecucion de 2 javascript

Código Javascript:
Ver original
  1. var whizzywig_version='Whizzywig 63';
  2. var btn=[]; //object containing button strip information
  3.  btn._w=16; btn._h=16; btn._f=getDir()+"icons.png"; //set to path to toolbar image
  4. var buttonPath,  //path to custom toolbar button images; "textbuttons" means don't use images
  5. buttonExt,   //extension (e.g. .png) for toolbar button images;  default '.gif'
  6. cssFile,     //url of CSS stylesheet to attach to edit area
  7. imageBrowse, //path to page for image browser
  8. linkBrowse,  //path to page for link browser
  9. idTa,        //id of the textarea (param to makeWhizzyWig)
  10. //OTHER GLOBALS //Whizzy contentWindow, current sel, range, parent, DOM path, popwindow, window, IE?;
  11. oW, sel, rng, papa, trail, ppw, wn=window, msIE=("Microsoft Internet Explorer"==navigator.appName)
  12. sels='',buts='',vals=[],opts=[],dobut=[],whizzies=[],taOrigSize=[];
  13.  
  14. function makeWhizzyWig(txtArea, controls){ // make a WhizzyWig from the textarea
  15.  idTa=txtArea;
  16.  whizzies[whizzies.length]=idTa;
  17.  if (!document.designMode) {
  18.   if (idTa.nodeName=="TEXTAREA"){tagButs();}
  19.   alert("Whizzywig "+t("editor not available for your browser"));
  20.   return;
  21.  }
  22.  var taContent=o(idTa).defaultValue ? o(idTa).defaultValue : o(idTa).innerHTML ? o(idTa).innerHTML: ''; //anything in the textarea?
  23.  if (!o(idTa).rows < 5){o(idTa).rows='15';}//IE won't use % from style
  24.  taWidth=o(idTa).style.width ? o(idTa).style.width : o(idTa).cols + "ex";  //grab the width and...
  25.  taHeight=o(idTa).style.height ? o(idTa).style.height : o(idTa).rows + "em";  //...height from the textarea
  26.  taOrigSize[idTa] = {w:taWidth,h:taHeight};
  27.  //Create whizzy container
  28.  var wContainer = document.createElement('div');
  29.  wContainer.id = 'CONTAINER'+idTa+'';
  30.  wContainer.style.width = taWidth;
  31.  var taObject = o(idTa);
  32.  o(idTa).parentNode.replaceChild(wContainer, o(idTa));
  33.  o("CONTAINER"+idTa).appendChild(taObject);
  34.  //End whizzy container
  35.  if (o(idTa).nodeName=="TEXTAREA"){
  36.  o(idTa).style.color='#060';
  37.  o(idTa).style.zIndex='2';
  38.  }else{w('<input type="hidden" id="wzhid_'+idTa+'" name="'+idTa+'" />')}
  39.  h(idTa);
  40.  var frm=o(idTa).parentNode;
  41.  while(frm.nodeName != 'FORM'){frm=frm.parentNode}//if not form, keep trying
  42.  addEvt(frm,"submit",syncTextarea);
  43.  w('<style type="text/css">button {vertical-align:middle;padding:0;margin:1px 0} button img{vertical-align:middle;margin:-1px} select{vertical-align:middle;margin:1px}  .wzCtrl {background:ButtonFace; border:1px outset ButtonShadow; padding:5px;} #sourceTa{color:#060;font-family:mono;}</style>');
  44.  var dsels='formatblock fontname fontsize';
  45.  var dbuts=' bold italic underline | left center right justify | number bullet indent outdent | undo redo | color hilite rule | link image table | clean html spellcheck fullscreen ';
  46.  var tbuts=' tstart add_row_above add_row_below delete_row | add_column_before add_column_after delete_column | table_in_cell';
  47.  var t_end=''; //table controls end, if needed
  48.  btns=(dbuts+tbuts).split(' ');
  49.  for (var i=0,pos=0;i<btns.length;i++) {
  50.   if(btns[i] && btns[i]!='|' && btns[i]!='tstart'){btn[btns[i]]=btn._w*pos++}
  51.  }
  52.  controls=controls ? controls.toLowerCase() : "all";
  53.  if(controls == "all"){controls=dsels +' newline '+ buts + dbuts + tbuts}
  54.  else{controls += tbuts}
  55.  w('<div onmouseover="c(\''+idTa+'\')"><div id="CONTROLS'+idTa+'" class="wzCtrl" unselectable="on">');
  56.  gizmos=controls.split(' ');
  57.  for (i=0;i<gizmos.length;i++){
  58.   if (gizmos[i]){ //make buttons and selects for toolbar, in order requested
  59.    if (gizmos[i] == 'tstart') {
  60.     w('<div id="TABLE_CONTROLS'+idTa+'" style="display:none" unselectable="on">');
  61.     t_end='</div>';
  62.    }
  63.    else if(gizmos[i]=='|'){w('&nbsp;<big style="padding-bottom:2em">|</big>&nbsp;')}
  64.    else if(gizmos[i] == 'newline'){w('<br>')}
  65.    else if((dsels+sels).indexOf(gizmos[i]) != -1){makeSelect(gizmos[i])}
  66.    else if((dbuts+buts+tbuts).indexOf(gizmos[i]) != -1){makeButton(gizmos[i])}
  67.   }
  68.  }
  69.  w(t_end)//table controls end
  70.  w('<a href="http://www.unverse.net" style="color:buttonface" title="'+whizzywig_version+'">.</a> ');
  71.  w(fGo('LINK'));
  72.  if (linkBrowse){w('<input type="button" onclick=doWin("'+linkBrowse+'"); value="'+t("Browse")+'"> ')}
  73.  w(t('Link address (URL)')+': <input type="text" id="lf_url'+idTa+'" size="60"><br><input type="button" value="http://" onclick="o(\'lf_url'+idTa+'\').value=\'http://\'+o(\'lf_url'+idTa+'\').value"> <input type="button" value="mailto:" onclick="o(\'lf_url'+idTa+'\').value=\'mailto:\'+o(\'lf_url'+idTa+'\').value"><input type="checkbox" id="lf_new'+idTa+'">'+t("Open link in new window")+fNo(t("OK"),"insertLink()"));//LINK_FORM end
  74.  w(fGo('IMAGE'));
  75.  if(imageBrowse){w('<input type="button" onclick=doWin("'+imageBrowse+'"); value="'+t("Browse")+'"> ')}
  76.  w(t('Image address (URL)')+': <input type="text" id="if_url'+idTa+'" size="50"> <label title='+t("to display if image unavailable")+'><br>'+t("Alternate text")+':<input id="if_alt'+idTa+'" type="text" size="50"></label><br>'+t("Align")+':<select id="if_side'+idTa+'"><option value="none">_&hearts;_ '+t("normal")+'</option><option value="left">&hearts;= &nbsp;'+t("left")+'</option><option value="right">=&hearts; &nbsp;'+t("right")+'</option></select> '+t("Border")+':<input type="text" id="if_border'+idTa+'" size="20" value="0" title="'+t("number or CSS e.g. 3px maroon outset")+'"> '+t("Margin")+':<input type="text" id="if_margin'+idTa+'" size="20" value="0" title="'+t("number or CSS e.g. 5px 1em")+'">'+fNo(t("Insert Image"),"insertImage()"));//IMAGE_FORM end
  77.  w(fGo('TABLE')+t("Rows")+':<input type="text" id="tf_rows'+idTa+'" size="2" value="3"> <select id="tf_head'+idTa+'"><option value="0">'+t("No header row")+'</option><option value="1">'+t("Include header row")+'</option></select> '+t("Columns")+':<input type="text" id="tf_cols'+idTa+'" size="2" value="3"> '+t("Border width")+':<input type="text" id="tf_border'+idTa+'" size="2" value="1"> '+fNo(t("Insert Table"),"makeTable()"));//TABLE_FORM end
  78.  w(fGo('COLOR')+'<input type="hidden" id="cf_cmd'+idTa+'"><div style="background:#000;padding:1px;height:22px;width:125px;float:left"><div id="cPrvw'+idTa+'" style="background-color:red; height:100%; width:100%"></div></div> <input type=text id="cf_color'+idTa+'" value="red" size=17 onpaste=vC(value) onblur=vC(value)> <input type="button" onmouseover=vC() onclick=sC() value="'+t("OK")+'">  <input type="button" onclick="hideDialogs();" value="'+t("Cancel")+'"><br> '+t("click below or enter a")+' <a href="http://www.unverse.net/colortable.htm" target="_blank">'+t("color name")+'</a><br clear=all> <table border=0 cellspacing=1 cellpadding=0 width=480 bgcolor="#000000">'+"\n");
  79.  var wC=new Array("00","33","66","99","CC","FF")  //color table
  80.  for (i=0; i<wC.length; i++){
  81.   w("<tr>");
  82.   for (j=0; j<wC.length; j++){
  83.    for (k=0; k<wC.length; k++){
  84.     var clr=wC[i]+wC[j]+wC[k];
  85.     w(' <td style="background:#'+clr+';height:12px;width:12px" onmouseover=vC("#'+clr+'") onclick=sC("#'+clr+'")></td>'+"\n");
  86.    }
  87.   }
  88.   w('</tr>');
  89.  }
  90.  w("</table></div>\n"); //end color table,COLOR_FORM
  91.  w("</div>\n"); //controls end
  92.  w('<div class="wzCtrl" id="showWYSIWYG'+idTa+'" style="display:none"><input type="button" onclick="showDesign();" value="'+t("Hide HTML")+'">');
  93.  tagButs();
  94.  w('</div>'+"\n");
  95.  w('<iframe style="border:1px inset ButtonShadow;width:100%;height:'+taHeight+'" src="javascript:;" id="whizzy'+idTa+'"></iframe></div>'+"\n", true); //finally write content to whizzy container
  96.  var startHTML="<html>\n<head>\n<style>td,th{border:1px dotted #888}</style>\n";
  97.  if(cssFile){startHTML += '<link media="all" type="text/css" href="'+cssFile+'" rel="stylesheet">\n'}
  98.  startHTML += '</head>\n<body id="'+idTa+'" style="background-image:none">\n'+tidyD(taContent)+'</body>\n</html>';
  99.  oW=o("whizzy"+idTa).contentWindow;
  100.  var d=oW.document;
  101.  try{d.designMode="on";} catch(e){ setTimeout('oW.designMode="on";', 100);}
  102.  d.open(); d.write(startHTML); d.close();
  103.  if(oW.addEventListener){oW.addEventListener("keypress", kb_handler, true)}//keyboard shortcuts for Moz
  104.  else{d.body.attachEvent("onpaste",function(){setTimeout('cleanUp()',10)})}
  105.  addEvt(d,"mouseup", whereAmI); addEvt(d,"keyup", whereAmI); addEvt(d,"dblclick", doDbl);
  106.  //move textarea so html menu appears on top
  107.  taObject = o(idTa);
  108.  o("CONTAINER"+idTa).removeChild(o(idTa));
  109.  o("CONTAINER"+idTa).appendChild(taObject);
  110.  //end move
  111.  idTa=null;
  112. } //end makeWhizzyWig
  113. function whizzywig(controls){
  114.  var i,ta=document.getElementsByTagName('TEXTAREA');
  115.  for (i=0;i<ta.length;i++){
  116.   if(!ta[i].id){ta[i].id=ta.name}
  117.   makeWhizzyWig(ta[i].id,controls);
  118.  }
  119. }
...Sigue