Cuando se hace clic en algún lugar de una determinada página web, abre una nueva página (como un enlace)

I would like to make the whole webpage, index.html for example to act as a link. Wherever you click it would open a new tab/window with the specified url. After it has been clicked, let the user do whatever he wanted to do. I would also like to make the page act like a url from 12 to 12 hours, also a specified time. I don't know how to start, I hope that somebody will point me in the right direction.

Muchas Gracias

preguntado el 01 de febrero de 12 a las 22:02

Actually, no, I haven't. Searched for it, but don't know hat keywords should I use, or maybe there is a therm for this which I don't know about. -

Did a little research and found this : $(".myBox").click(function(){ window.location=$(this).find("a").attr("href"); return false; }); <div class="myBox"> blah blah blah. <a href="">link</a> </div> -

Bienvenido a Stack Overflow. Me temo que no podremos ayudarlo ya que su pregunta carece de detalles. ¿Qué intentaste hasta ahora, cuál fue el resultado? Por favor también lea -

1 Respuestas

Assuming I properly understood your question: you probably want to do this to force them to follow an ad or something.

To make the entire page a link: use a div with a width and height of 95-100% (using 100% in some browsers will cause the page itself to expand a little) as well as making the div's position absolute. This will act as an overlay and essentially force them to click on it. Wrap the div in an anchor tag with a target of "_blank" or add an onclick to the div which executes JavaScript that does the same thing.

The onclick method is probably better since you also want the onclick to set the div's display to "none" in order to let them continue doing whatever on your site.

Wanting to only do it between a certain time frame would require using JavaScript to fetch the local time for that person (you can also fetch their time zone in order to convert it to your own time zone) and then determine if it is between the time frame you want the overlay to appear. If it is, it will set the div's display to "" or "block", otherwise the div will remain as "none"

Respondido 08 Feb 12, 10:02

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.