Ver Mensaje Individual
  #8 (permalink)  
Antiguo 17/03/2014, 05:08
Avatar de satjaen
satjaen
 
Fecha de Ingreso: septiembre-2012
Ubicación: Jaén (Andalucía)
Mensajes: 893
Antigüedad: 11 años, 8 meses
Puntos: 10
Respuesta: Consulta de código

Cita:
Iniciado por Alexis88 Ver Mensaje
En un pseudo-atributo data, coloca la dirección que deseas abrir, de este modo, cada input abrirá una página distinta.

DEMO

Saludos
Alexis para hacer esto necesitare algun enlace jQuery o libreria no ?


Código Javascript:
Ver original
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5. <title>Documento sin título</title>
  6. </head>
  7. <script>
  8. var availableTags = ["PHP", "JavaScript", "CSS", "jQuery"];
  9. $(".ejemplo").autocomplete({
  10.     source: availableTags
  11. }).keypress(function (e) {
  12.     if (e.keyCode == 13) window.open(this.getAttribute("data-link") + "?q=" + this.value, "PopUp", "width=500, height=300");
  13. });
  14. </script>
  15. <body>
  16. Caja 1:
  17. <input type="text" class="ejemplo" data-link="http://www.google.com" />
  18. <br />Caja 2:
  19. <input type="text" class="ejemplo" data-link="http://www.bing.com" />
  20. </body>
  21. </html>