| ||||
Hola deccweb:Si que se puede ... ![]() Si en la página principal el campo de texto se llama imagen, y está en un formulario que se llama datos (por ejemplo)... cuando tengas el nombre de la imagen tienes que asignarla más o menos así: opener.document.forms.datos.imagen.value = nombre_obtenido_en_popup; (esta línea debe ser del popup) Saludos ![]() |
| ||||
Hola otra vez: La cuestión es que depende de tus páginas... ![]() Yo hice algo parecido aquí: http://www.pepemolina.com/archivos_bd/index.html (solo es una prueba que luego adapté mejor en mi libro de visitas) En el ejemplo las imágenes se suben a una base de datos y se recoge un código de inserción en un textarea, y a la vez se muestra en pantalla (puedes probarlo, pero si lo haces pon algo bonito... ya tuve que eliminar cosas indebidas) En mi página tengo este código para recoger los valores: Código PHP: opener.devolver("imagen.php?id=" + id); Está dentro de la función paso3() del popup (leer.html)... ![]() Saludos ![]() |
| ||||
.. 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> |
| ||||
Código HTML: <span class="largetext"><a href="javascript:emoticon('<br>')">Espacio (br)</a></span> <span class="gensmall"><a href="javascript:bbstyle(-1)" class="largetext" onMouseOver="helpline('a')"><font size=1 face=verdana color=black>Cerrar etiqueta</a></span><span class="gensmall"><br> <input type="text" name="helpbox" size="45" maxlength="100" style="background-color: D1E7FF; color: #000000; font-family: Verdana; font-size: 10 pt; border: 1 solid #357A9e; width:450px" class="helpline" value=""><br> </span> <span class="largetext"> <script language="JavaScript"> function calcLong(txt, dst, formul, maximo) { var largo largo = formul[txt].value.length if (largo > maximo) formul[txt].value = formul[txt].value.substring(0,maximo) formul[dst].value = formul[txt].value.length } </script> <textarea name="noticia" rows="15" cols="35" wrap="virtual" style="background-color: D1E7FF; color: #000000; font-family: Verdana; font-size: 7.5 pt; border: 1 solid #357A9e; width:550px" tabindex="3" class="post" onselect="storeCaret(this);" onclick="storeCaret(this);" onkeyup="storeCaret(this);" ></textarea> <input name="caracteres" type="text" id="caracteres" value="0" size="4" style="background-color: D1E7FF; color: #000000; font-family: Arial Black; font-size: 15 pt; border: 1 solid #357A9e; width:50px" tabindex="3"> </span> </td><td> <a href="javascript:emoticon('<img src=emoticonos/icon_biggrin.gif>')"><img src="emoticonos/icon_biggrin.gif" border="0" alt="Very Happy" title="Very Happy"></a> <a href="javascript:emoticon('<img src=emoticonos/icon_smile.gif>')"><img src="emoticonos/icon_smile.gif" border="0" alt="Smile" title="Smile"></a> <a href="javascript:emoticon('<img src=emoticonos/icon_sad.gif>')"><img src="emoticonos/icon_sad.gif" border="0" alt="Sad" title="Sad"></a> <a href="javascript:emoticon('<img src=emoticonos/icon_surprised.gif>')"><img src="emoticonos/icon_surprised.gif" border="0" alt="Surprised" title="Surprised"></a> <a href="javascript:emoticon('<img src=emoticonos/icon_eek.gif>')"><img src="emoticonos/icon_eek.gif" border="0" alt="Shocked" title="Shocked"></a> <a href="javascript:emoticon('<img src=emoticonos/icon_confused.gif>')"><img src="emoticonos/icon_confused.gif" border="0" alt="Confused" title="Confused"></a> <a href="javascript:emoticon('<img src=emoticonos/icon_cool.gif>')"><img src="emoticonos/icon_cool.gif" border="0" alt="Cool" title="Cool"></a> <a href="javascript:emoticon('<img src=emoticonos/icon_lol.gif>')"><img src="emoticonos/icon_lol.gif" border="0" alt="Laughing" title="Laughing"></a> <a href="javascript:emoticon('<img src=emoticonos/icon_mad.gif>')"><img src="emoticonos/icon_mad.gif" border="0" alt="Mad" title="Mad"></a> <a href="javascript:emoticon('<img src=emoticonos/icon_razz.gif>')"><img src="emoticonos/icon_razz.gif" border="0" alt="Razz" title="Razz"></a> <a href="javascript:emoticon('<img src=emoticonos/icon_redface.gif>')"><img src="emoticonos/icon_redface.gif" border="0" alt="Embarassed" title="Embarassed"></a> <a href="javascript:emoticon('<img src=emoticonos/icon_cry.gif>')"><img src="emoticonos/icon_cry.gif" border="0" alt="Crying or Very sad" title="Crying or Very sad"></a> <a href="javascript:emoticon('<img src=emoticonos/icon_evil.gif>')"><img src="emoticonos/icon_evil.gif" border="0" alt="Evil or Very Mad" title="Evil or Very Mad"></a> <a href="javascript:emoticon('<img src=emoticonos/icon_twisted.gif>')"><img src="emoticonos/icon_twisted.gif" border="0" alt="Twisted Evil" title="Twisted Evil"></a> <a href="javascript:emoticon('<img src=emoticonos/icon_rolleyes.gif>')"><img src="emoticonos/icon_rolleyes.gif" border="0" alt="Rolling Eyes" title="Rolling Eyes"></a> <a href="javascript:emoticon('<img src=emoticonos/icon_wink.gif>')"><img src="emoticonos/icon_wink.gif" border="0" alt="Wink" title="Wink"></a> <a href="javascript:emoticon('<img src=emoticonos/icon_exclaim.gif>')"><img src="emoticonos/icon_exclaim.gif" border="0" alt="Exclamation" title="Exclamation"></a> <a href="javascript:emoticon('<img src=emoticonos/icon_question.gif>')"><img src="emoticonos/icon_question.gif" border="0" alt="Question" title="Question"></a> <a href="javascript:emoticon('<img src=emoticonos/icon_idea.gif>')"><img src="emoticonos/icon_idea.gif" border="0" alt="Idea" title="Idea"></a> <a href="javascript:emoticon('<img src=emoticonos/icon_arrow.gif>')"><img src="emoticonos/icon_arrow.gif" border="0" alt="Arrow" title="Arrow"></a> <a href="javascript:emoticon('<img src=emoticonos/file.gif>')"><img src="emoticonos/file.gif" border="0" alt="Arrow" title="Arrow"></a> </td></tr><tr> <td> <p><font size=1 face=verdana> Más:<br> <textarea name="mas" rows="15" cols="35" style="background-color: D1E7FF; color: #000000; font-family: Verdana; font-size: 7.5 pt; border: 1 solid #357A9e; width:650px; height:450px"> </textarea><br> Nombre de la imagen:<font color=888888>Para no poner ninguna imagen poner "imagen.gif"</font><br> <input type="text" name="imagen" value="imagen.gif" size="40" style="background-color: D1E7FF; color: #000000; font-family: Verdana; font-size: 10 pt; border: 1 solid #357A9e"></p> </td> <td> <p><input type="submit" value="Ingresar noticia" name="enviar" style="background-color: D1E7FF; color: #000000; font-family: Verdana; font-size: 10 pt; border: 1 solid #357A9e"></p> <Script language="Javascript"> function probar() { f = window.open(); f.document.write(document.post.noticia.value); f.document.close(); } </script> <a href=# onclick="probar()">Ver noticia antes de enviar</a> </form> </td></tr></table> </body> </html> Popup antes de enviar Código HTML: 19:07 28/05/2004 <HTML> <HEAD> <TITLE>Noticias</TITLE> <script language="JavaScript" type="text/JavaScript"> <!-- function MM_reloadPage(init) { //reloads the window if Nav4 resized if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) { document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }} else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload(); } MM_reloadPage(true); //--> </script> </HEAD> <BODY bgcolor="#ffffff" link="#0099ff" vlink="#999999" alink="#000000"> <div id="Layer1" style="position:absolute; left:8px; top:151px; width:713px; height:229px; z-index:1"><img src="reglas.gif" width="853" height="470"></div> <div id="Layer2" style="position:absolute; left:31px; top:174px; width:707px; height:441px; z-index:2"><img src="imagen.gif" name="imagen"></div> <TABLE> <font size=1 face=verdana>Enviar imagen o archivo<br> <br> <FORM ENCTYPE="multipart/form-data" ACTION="http://www.calle17.com/noticias.php" METHOD="post"> <INPUT NAME="UploadedFile" TYPE="file" onChange="document.imagen.src='file:///' + this.value" style="background-color: D1E7FF; color: #000000; font-family: Verdana; font-size: 10 pt; border: 1 solid #357A9e"> <INPUT TYPE="submit" VALUE="Enviar archivo" style="background-color: D1E7FF; color: #000000; font-family: Verdana; font-size: 10 pt; border: 1 solid #357A9e"> </FORM> Vista previa:<br> <br> <br> </BODY> </HTML> Código HTML: <HTML> <HEAD> <TITLE>Upload in php</TITLE> <script> function ponPrefijo(pref){ opener.document.formul.prefijo.value = pref window.close() } </script> </HEAD> <BODY> <br><br> <font size=1 face=verdana>Nombre del Archivo: bord_sup.gif <BR> <HR><form name=fprefijos><input type=Button value=bord_sup.gif onclick=ponPrefijo('+34')> Ha sido enviado correctamente a calle17.com <br>Archivo de imagen: <img src=public/noticias/actualidad/bord_sup.gif> <BR> <a href=javascript:history.back(1)>Enviar más archivos</a> <input type=text name=titulo value=bord_sup.gif> Otro tipo de archivo: <a href=public/noticias/actualidad/bord_sup.gif target=blank>DESCARGAR</a><BR> </font></BODY> </HTML> |