...

View Full Version : Self.opener



FlashO
04-29-2008, 04:41 PM
Hi

I write in a text box and sending it to a select multiple. This code works perfectly in firefox, but not in Internet Explorer. Anyone know why?

Thank you very much

The code:



function MM_openBrWindow(theURL,winName,features) {
window.open(theURL+'?tag='+document.form1.usuario.value,winName,features);
}





<script language="JavaScript">
function test3(valor,valor2) {
self.opener.document.form1.idoc.value=valor2; //idoc is hidden
self.opener.document.form1.txtoc.value=valor; //txtoc is hidden

obj2=self.opener.document.getElementById('seleccionados');
opc = new Option(valor2,valor);
eval(obj2.options[obj2.options.length]=opc);
window.close();
}
</script>

abduraooft
04-29-2008, 04:58 PM
I'm sorry, but the above code should exhibit the same behavior in almost all browsers for us ;) (haven't tested though)

You need to show the rest of your code, the html part :)

FlashO
04-29-2008, 05:28 PM
Sorry
The pop up:


<script language="JavaScript">
function test3(valor,valor2) {
self.opener.document.form1.idoc.value=valor2; //idoc is hidden
self.opener.document.form1.txtoc.value=valor; //txtoc is hidden

obj2=self.opener.document.getElementById('seleccionados');
opc = new Option(valor2,valor);
eval(obj2.options[obj2.options.length]=opc);
window.close();
}
</script>



<body>
<%

var=request.QueryString("tag")%>


<%



strConn = "driver={SQL Server};server="&session("ipfija")&";UID="&session("dbfija")&";PWD="&session("passfija")&";database="&session("dbfija")

Set Conexion= Server.CreateObject("ADODB.Connection")
Conexion.Open strConn
Set Registro = CreateObject("ADODB.RecordSet")
DnsText2 = *************************************
tipousuario="1"
heren="0"
SqlTexttag6 = "SELECT * FROM tags WHERE nombre='"&var&"' and tipo="&tipousuario
Registro.Open SqlTexttag6, DnsText2,3,3
if not Registro.eof then
response.write("EXISTE")
Response.write (Registro("id"))
idoc=Registro("id")
session("idoc")=idoc
else
Conexion.Execute ("INSERT INTO Tags (nombre, herencia, tipo) VALUES ('"&var&"', '0', '"&tipousuario&"')")
set Registro2 = Conexion.execute("select MAX(ID) from tags")
idoc=Registro2(0)
session("idoc")=idoc
END IF

%>


<script language="JavaScript" type="text/javascript">
test3('<%=idoc%>','<%=var%>');
</script>

</body>



The main page:



function MM_openBrWindow(theURL,winName,features) {
window.open(theURL+'?tag='+document.form1.usuario.value,winName,features);
}


<td width="41%"><%if identificador="" then%>
<select name="seleccionados" size="15" multiple class="textonormal" id="seleccionados" style=" font-size:9px;width:200px " ondblclick="eliminar(this.form)">
</select>
<%else%>
<select name="seleccionados" size="15" multiple class="textonormal" id="seleccionados" style=" font-size:9px;width:200px " ondblclick="eliminar(this.form)">
<%Set Rstag = CreateObject("ADODB.RecordSet")
SqlTexttag = "SELECT idtag FROM relacional WHERE tipo=0 and idOrigen="&identificador
Rstag.Open SqlTexttag, DnsText2,3,3
if not Rstag.eof then
Do while not rstag.eof
Set Rs3 = CreateObject("ADODB.RecordSet")
SqlText3 = "SELECT nombre FROM Tags WHERE id="&rstag("idtag")
Rs3.Open SqlText3, DnsText2,3,3
if not Rs3.eof then
nombredeltag=rs3("nombre")
end if
rs3.close
%>
<option value=<%=rstag("idtag")%>><%=nombredeltag%></option>
<%rstag.movenext

loop
end if

Rstag.close%>
</select>
<%end if%> </td>



<td><span class="Estilo14">Nuevo Tag:</span>
<input id="usuario" name="usuario" type="text">
<br>
<input id="idoc" type="hidden">
<input id="txtoc" type="hidden"></td>
<td><input name="add2" type="button" id="add" value="&nbsp;>&nbsp;" onClick="MM_openBrWindow('/control/basededatos/grabartag.asp','','scrollbars=yes,width=0.01,height=0.01')"></td>

abduraooft
04-29-2008, 05:31 PM
That also doesn't make any difference either! How can we execute that server side script?
Take the generated client side code (from browser's view source option) and post the relevant parts.

mjlorbet
04-29-2008, 05:52 PM
use window.opener instead of self.opener



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum