Lo siento caricatos, lo he probado, pero no me funciona. te dejo aqui el codigo haber si puedes averiguar el pq. y de paso podeis mirar el codigo para poner los emoticonos en un textarea tipo este foro.
Pagina formulario Código HTML:
<html>
<head>
<title>Página principal</title>
<script>
var miPopup
function abreVentana(){
miPopup = window.open("formularioimagen.htm","miwin","width=300,height=150,scrollbars=yes")
miPopup.focus()
}
</script>
<script language="JavaScript" type="text/javascript">
<!--
// bbCode control by
// subBlue design
// [url]www.subBlue.com[/url]
// Startup variables
var imageTag = false;
var theSelection = false;
// Check for Browser & Platform for PC & IE specific bits
// More details from: [url]http://www.mozilla.org/docs/web-developer/sniffer/browser_type.html[/url]
var clientPC = navigator.userAgent.toLowerCase(); // Get client info
var clientVer = parseInt(navigator.appVersion); // Get browser version
var is_ie = ((clientPC.indexOf("msie") != -1) && (clientPC.indexOf("opera") == -1));
var is_nav = ((clientPC.indexOf('mozilla')!=-1) && (clientPC.indexOf('spoofer')==-1)
&& (clientPC.indexOf('compatible') == -1) && (clientPC.indexOf('opera')==-1)
&& (clientPC.indexOf('webtv')==-1) && (clientPC.indexOf('hotjava')==-1));
var is_win = ((clientPC.indexOf("win")!=-1) || (clientPC.indexOf("16bit") != -1));
var is_mac = (clientPC.indexOf("mac")!=-1);
// Helpline messages
b_help = "Negrita: <b>texto</b> (alt+b)";
i_help = "Cursiva: <i>texto</i> (alt+i)";
r_help = "Espaciado: <br> (alt+r)";
q_help = "Cita: [quote]text[/quote] (alt+q)";
c_help = "Codi: [code]codi[/code] (alt+c)";
l_help = "Llista:[list]text[/list](alt+l)";
o_help = "Llista ordenada:[list=]text[/list](alt+o)";
p_help = "Insertar imagen: <img src=url_imatge> (alt+p)";
w_help = "Insertar URL: <a href=url></a> o (alt+w)";
a_help = "Cerrar la etiqueta";
s_help = "Color: <font color=red>texto</font>";
f_help = "Mida: [size=x-small]text petit[/size]";
// Define the bbCode tags
bbcode = new Array();
bbtags = new Array('<b>','</b>','<i>','</i>','<br>','','<quote>','</quote>','<code>','</code>','<list>','</list>','<list=>','</list>','<img src=actualidad/>','','<a href=>','</a>');
imageTag = false;
// Shows the help noticias in the helpline window
function helpline(help) {
document.post.helpbox.value = eval(help + "_help");
}
// Replacement for arrayname.length property
function getarraysize(thearray) {
for (i = 0; i < thearray.length; i++) {
if ((thearray[i] == "undefined") || (thearray[i] == "") || (thearray[i] == null))
return i;
}
return thearray.length;
}
// Replacement for arrayname.push(value) not implemented in IE until version 5.5
// Appends element to the array
function arraypush(thearray,value) {
thearray[ getarraysize(thearray) ] = value;
}
// Replacement for arrayname.pop() not implemented in IE until version 5.5
// Removes and returns the last element of an array
function arraypop(thearray) {
thearraysize = getarraysize(thearray);
retval = thearray[thearraysize - 1];
delete thearray[thearraysize - 1];
return retval;
}
function checkForm() {
formErrors = false;
if (document.post.noticia.value.length < 2) {
formErrors = "Has d'escriure un missatge quan publiques";
}
if (formErrors) {
alert(formErrors);
return false;
} else {
bbstyle(-1);
//formObj.preview.disabled = true;
//formObj.submit.disabled = true;
return true;
}
}
function emoticon(text) {
text = ' ' + text + ' ';
if (document.post.noticia.createTextRange && document.post.noticia.caretPos) {
var caretPos = document.post.noticia.caretPos;
caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? text + ' ' : text;
document.post.noticia.focus();
} else {
document.post.noticia.value += text;
document.post.noticia.focus();
}
}
function bbfontstyle(bbopen, bbclose) {
if ((clientVer >= 4) && is_ie && is_win) {
theSelection = document.selection.createRange().text;
if (!theSelection) {
document.post.noticia.value += bbopen + bbclose;
document.post.noticia.focus();
return;
}
document.selection.createRange().text = bbopen + theSelection + bbclose;
document.post.noticia.focus();
return;
} else {
document.post.noticia.value += bbopen + bbclose;
document.post.noticia.focus();
return;
}
storeCaret(document.post.noticia);
}
function bbstyle(bbnumber) {
donotinsert = false;
theSelection = false;
bblast = 0;
if (bbnumber == -1) { // Close all open tags & default button names
while (bbcode[0]) {
butnumber = arraypop(bbcode) - 1;
document.post.noticia.value += bbtags[butnumber + 1];
buttext = eval('document.post.addbbcode' + butnumber + '.value');
eval('document.post.addbbcode' + butnumber + '.value ="' + buttext.substr(0,(buttext.length - 1)) + '"');
}
imageTag = false; // All tags are closed including image tags :D
document.post.noticia.focus();
return;
}
if ((clientVer >= 4) && is_ie && is_win)
theSelection = document.selection.createRange().text; // Get text selection
if (theSelection) {
// Add tags around selection
document.selection.createRange().text = bbtags[bbnumber] + theSelection + bbtags[bbnumber+1];
document.post.noticia.focus();
theSelection = '';
return;
}
// Find last occurance of an open tag the same as the one just clicked
for (i = 0; i < bbcode.length; i++) {
if (bbcode[i] == bbnumber+1) {
bblast = i;
donotinsert = true;
}
}
if (donotinsert) { // Close all open tags up to the one just clicked & default button names
while (bbcode[bblast]) {
butnumber = arraypop(bbcode) - 1;
document.post.noticia.value += bbtags[butnumber + 1];
buttext = eval('document.post.addbbcode' + butnumber + '.value');
eval('document.post.addbbcode' + butnumber + '.value ="' + buttext.substr(0,(buttext.length - 1)) + '"');
imageTag = false;
}
document.post.noticia.focus();
return;
} else { // Open tags
if (imageTag && (bbnumber != 14)) { // Close image tag before adding another
document.post.noticia.value += bbtags[15];
lastValue = arraypop(bbcode) - 1; // Remove the close image tag from the list
document.post.addbbcode14.value = "Img"; // Return button back to normal state
imageTag = false;
}
// Open tag
document.post.noticia.value += bbtags[bbnumber];
if ((bbnumber == 14) && (imageTag == false)) imageTag = 1; // Check to stop additional tags after an unclosed image tag
arraypush(bbcode,bbnumber+1);
eval('document.post.addbbcode'+bbnumber+'.value += "*"');
document.post.noticia.focus();
return;
}
storeCaret(document.post.noticia);
}
// Insert at Claret position. Code from
// [url]http://www.faqts.com/knowledge_base/view.phtml/aid/1052/fid/130[/url]
function storeCaret(textEl) {
if (textEl.createTextRange) textEl.caretPos = document.selection.createRange().duplicate();
}
//-->
</script>
</head>
<body>
<font size=1 face=verdana>
<table><tr><td>
<form method="POST" name="post" action="agrega_noticia.asp" onsubmit="return checkForm(this)" onKeyUp="calcLong('noticia', 'caracteres',this, 700)"><form name="ver_sitio">
<p><font size=1 face=verdana>Tiulo de la noticia:<br>
<input type="text" name="titulo" size="40" maxlength="50" style="background-color: D1E7FF; color: #000000; font-family: Verdana; font-size: 10 pt; border: 1 solid #357A9e"></p>
</td>
<td> <p><font size=1 face=verdana>Noticia de:<br>
<select NAME="copete" style="background-color: D1E7FF; color: #000000; font-family: Verdana; font-size: 10 pt; border: 1 solid #357A9e">
<option>Dzollo
<option>edgar
<option>carlos
<option>JaViSiTo
<option>David
<option>Korilla
<option>Frak
<option>Mateo Lara
<option>senci
<option>webmasters
<option SELECTED>usuario
</select>
</td><font size=1 face=verdana>Categoria:<br>
<select NAME="categoria" style="background-color: D1E7FF; color: #000000; font-family: Verdana; font-size: 10 pt; border: 1 solid #357A9e">
<option>formula
<option>motor
<option>fotos
<option>humor
<option>cadenas
<option>musica
<option>motociclismo
<option>cine
<option>elinkmusica
<option>elinkvideo
<option>elinkjuegos
<option>juegos
<option>deportes
<option>videos
<option>tecnologia
<option>graffitis
<option SELECTED>actualidad
</select>
</td></tr>
<tr><td>
<br><p><font size=1 face=verdana>Noticia:<br>
<span class="largetext">
<input type="button" accesskey="b" name="addbbcode0" value=" Negrita " style="background-color: D1E7FF; color: #000000; font-family: Verdana; font-size: 10 pt; border: 1 solid #357A9e" onClick="bbstyle(0)" onMouseOver="helpline('b')">
</span>
<span class="largetext">
<input type="button" accesskey="i" name="addbbcode2" value=" Cursiva " style="background-color: D1E7FF; color: #000000; font-family: Verdana; font-size: 10 pt; border: 1 solid #357A9e" onClick="bbstyle(2)" onMouseOver="helpline('i')">
</span>
<span class="largetext">
<input type="button" accesskey="w" name="addbbcode16" value="URL" style="background-color: D1E7FF; color: #000000; font-family: Verdana; font-size: 10 pt; border: 1 solid #357A9e; text-decoration: underline; width: 40px" onClick="bbstyle(16)" onMouseOver="helpline('w')">
</span>