function ismaxlength(obj){ var mlength=obj.getAttribute? parseInt(obj.getAttribute("maxlength")) : "" if (obj.getAttribute && obj.value.length>mlength) obj.value=obj.value.substring(0,mlength) } // JavaScript Document function moveover(value) { if(value == "bold"){ change('**Texto en negrita**') } if(value == "italic"){ change('\'\'Texto en cursiva\'\'') } if(value == "underline"){ change('__Texto subrayado__') } if(value == "link"){ change('[paginainterna|Texto del enlace]') } if(value == "link2"){ change('[http://www.dominio.es|Texto del enlace]') } if(value == "linkmail"){ change('[sudireccion@dominio.es]') } if(value == "titulo1"){ change('! Título grande') } if(value == "titulo2"){ change('!! Título mediano') } if(value == "titulo3"){ change('!!! Título pequeño') } if(value == "imagen"){ change('[imageninterna.jpg]') } if(value == "imagengrande"){ change('[IMAGE]IMAGE LOCATION (must be a web address)[/IMAGE]') } if(value == "caja"){ change('[IMAGE]IMAGE LOCATION (must be a web address)[/IMAGE]') } if(value == "linea"){ change('[IMAGE]IMAGE LOCATION (must be a web address)[/IMAGE]') } if(value == "tabla"){ change('[IMAGE]IMAGE LOCATION (must be a web address)[/IMAGE]') } } function moveback(value) { //image.src = ""; if(value == "bold"){ change(' ') } if(value == "italic"){ change(' ') } if(value == "underline"){ change(' ') } if(value == "link"){ change(' ') } if(value == "link2"){ change(' ') } if(value == "linkmail"){ change(' ') } if(value == "titulo1"){ change(' ') } if(value == "titulo2"){ change(' ') } if(value == "titulo3"){ change(' ') } if(value == "imagen"){ change(' ') } if(value == "imagengrande"){ change(' ') } if(value == "caja"){ change(' ') } if(value == "linea"){ change(' ') } if(value == "tabla"){ change(' ') } } function append(symbol){ //var selectedText = document.selection; //if (selectedText.type == 'Text') { // var newRange = selectedText.createRange(); // symbol.focus(); // symbol = newRange.text; document.editor.message.value = symbol; //} } function clearMessage() { document.editor.message.value = ""; } function confirmSubmit() { var agree=confirm("Are you sure you want to delete?"); if (agree) return true ; else return false ; } function confirmPublish() { var agree=confirm("Are you sure you want to publish?"); if (agree) return true ; else return false ; } function denyPublish() { var agree=alert("Sorry, but this service is currently unavailable for this demo"); if (agree) return true ; else return false ; } function closewindow() { window.close() } function ask() { var link = prompt("Enter hyperlink. This can be either a web address or a local address, i.e. news.php","http://") if (link != null && link != "") { insert(document.editor.message, '[LINK][A]' + link + '[/A]', '[/LINK]', '') } } function change(html){ //descriptions.innerHTML=html } function color() { option=document.forms[0].dropdown.options[document.forms[0].dropdown.selectedIndex].value mystuff_array = option.split("|") insert(document.editor.message, mystuff_array[0], mystuff_array[1], '') } function put() { option=document.forms[0].crap.options[document.forms[0].crap.selectedIndex].value mystuff_array = option.split("|") insert(document.editor.message, mystuff_array[0], mystuff_array[1], '') //txt=option //document.editor.message.value +=txt } function size_font() { option=document.forms[0].stuff.options[document.forms[0].stuff.selectedIndex].value mystuff_array = option.split("|") insert(document.editor.message, mystuff_array[0], mystuff_array[1], '') } function store(obj){ if (obj.createTextRange){ obj.selection = document.selection.createRange().duplicate(); } return true; } function insert(objTxt, beg, end, txt) { var str = (objTxt.createTextRange && objTxt.selection) ? objTxt.selection.text : ""; str = formatString(objTxt, str, beg, end, txt); if (str == null) return true; if (objTxt.createTextRange && objTxt.selection) { var objTxtRange = objTxt.selection; objTxtRange.text = (objTxtRange.text.charAt(objTxtRange.text.length - 1) == ' ') ? str + ' ' : str; objTxt.selection = null; } else { objTxt.value += str; } document.editor.message.focus() return true; } function formatString(arg, inp, beg, end, txt) { var str = inp; if (arg.createTextRange && arg.selection) { if (str != null) { str = (arg.selection.text.charAt(arg.selection.text.length - 1) == ' ') ? str.replace(/\s+$/,"") : str; str = beg + str + end; } else { arg.selection = null; } } else { if (str != null) { str = beg + str + end; } } return str; } function tablas(columnas,filas) { if (columnas <= 0) { alert('Debe especificar el número de columas'); return false; } if (filas <= 0) { alert('Debe especificar el número de filas'); return false; } var caracteres_col = ''; for(i=1;i<=columnas;i++) { caracteres_col += 'columna||'; } // eliminamos los dos últimos carácteres caracteres_col = caracteres_col.substr(0,(caracteres_col.length)-2); var caracteres_fil = ''; for(i=1;i<=filas;i++) { caracteres_fil += '||||'+caracteres_col+'||||\r\n'; } insert(document.editor.message, caracteres_fil, '', '') }