Advertisement
idroj07

Comunicación ventana padre-hijo

Oct 15th, 2019
374
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!DOCTYPE html>
  2. <html lang="es">
  3. <head>
  4.     <meta charset="UTF-8">
  5.     <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6.     <meta http-equiv="X-UA-Compatible" content="ie=edge">
  7.     <title>3.5.1</title>
  8. </head>
  9. <body>
  10.  
  11.     <script type="application/javascript">
  12.        
  13.         const configVentanaSelColor = "width=620,height=330,top=100,left=500";
  14.  
  15.         function selectorColor() {
  16.            
  17.             function cambiarCol() {
  18.             let eleccion = document.getElementById("listaColores").value;
  19.             console.log(eleccion);
  20.             }
  21.  
  22.             let vSelColor = window.open("","Selector de Color",configVentanaSelColor);
  23.             // debugger;
  24.             // vSelColor.document.write("<script type='application/javascript'>");
  25.             //     vSelColor.document.write("console.log('TEST')");
  26.             // vSelColor.document.write("< /script>");
  27.  
  28.             // vSelColor.document.write("<body>");
  29.             // let scriptVentanaHija = "<script type='application/javascript'>" +
  30.             //     "() => {alert('test')}";
  31.  
  32.                 vSelColor.document.write("<h1>Selecciona un color para el texto:</h1>");
  33.                 vSelColor.document.write("<form id='form'>");
  34.                     vSelColor.document.write("<select id='listaColores'>");
  35.                         vSelColor.document.write("<option selected value='Rojo'>Rojo</option>");
  36.                         vSelColor.document.write("<option value='Azul'>Azul</option>");
  37.                         vSelColor.document.write("<option value='Amarillo'>Amarillo</option>");
  38.                         vSelColor.document.write("<option value='Verde'>Verde</option>");
  39.                     vSelColor.document.write("</select> ");
  40.                 vSelColor.document.write("</form>");
  41.                
  42.  
  43.                     vSelColor.document.write("<script type='application/javascript'>");
  44.                     vSelColor.document.write("function test() {window.opener.document.write(6)}");
  45.                     let finscript = "</script>";
  46.                     vSelColor.document.write(encodeURIComponent(finscript));
  47.  
  48.                 vSelColor.document.write("<button onclick='test()'>Modificar Color</button>");
  49.             // vSelColor.document.write("</body>")
  50.         }
  51.  
  52.  
  53.     </script>
  54.     <input  id= "nomColor" type="text"> <br><br>
  55.     <button name="ModifColor" onclick="selectorColor()" >Mostrar opciones de color</button>
  56.     <!-- <input type='button' onclick='window.opener.document.write(3)'> -->
  57. </body>
  58. </html>
  59.  
  60. <!-- form.color.options[color.selectedIndex].text\'> -->
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement