Entro con una url que me abrirá, y el destino de la capa donde lo abrirá
Código HTML:
<script> loadXMLDoc('url.php', 'Result'); </script> <div id="Result"></div> <script> loadXMLDoc('url2.php', 'Result2'); </script> <div id="Result2"></div>
Código HTML:
<script language="JavaScript"> <!-- var req = null; function loadXMLDoc(url, dest) { window['dest'] = dest; alert('alerta:'+window['dest']); // Internet Explorer try { req = new ActiveXObject("Msxml2.XMLHTTP"); } catch(e) { try { req = new ActiveXObject("Microsoft.XMLHTTP"); } catch(oc) { req = null; } } // Mozailla/Safari if (req == null && typeof XMLHttpRequest != "undefined") { req = new XMLHttpRequest(); } // Call the processChange() function when the page has loaded if (req != null) { req.onreadystatechange = processChange; req.open("GET", url, true); req.send(null); } } function processChange(evt) { // The page has loaded and the HTTP status code is 200 OK if (req.readyState == 4) { if (req.status == 200) { alert('he entrado '+window['dest']); // Write the contents of this URL to the searchResult layer getObject(window['dest']).innerHTML = req.responseText; } } } function getObject(name) { var ns4 = (document.layers) ? true : false; var w3c = (document.getElementById) ? true : false; var ie4 = (document.all) ? true : false; if (ns4) return eval('document.' + name); if (w3c) return document.getElementById(name); if (ie4) return eval('document.all.' + name); return false; } // --> </script>