[英]When clicked somewhere on a certain webpage, open a new page(like a link)
I would like to make the whole webpage, index.html for example to act as a link. 我想将整个网页(例如index.html)用作链接。 Wherever you click it would open a new tab/window with the specified url.
无论您在哪里单击它,都将使用指定的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.
我还想让页面在12到12个小时(也就是指定的时间)内像网址一样起作用。 I don't know how to start, I hope that somebody will point me in the right direction.
我不知道如何开始,我希望有人会指出正确的方向。
Thanks 谢谢
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. 要使整个页面成为链接,请执行以下操作:使用宽度和高度为95-100%的div(在某些浏览器中使用100%会使页面本身稍微扩展一点),以及将div的位置设为绝对。 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.
将div包裹在目标标记为“ _blank”的锚标记中,或向div添加onclick,该div执行执行相同功能的JavaScript。
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. onclick方法可能更好,因为您还希望onclick将div的显示设置为“ none”,以便让他们继续在您的网站上执行任何操作。
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. 想要只在某个时间范围内执行此操作,则需要使用JavaScript来获取该人的本地时间(您也可以获取他们的时区,以便将其转换为自己的时区),然后确定时间是否介于该时间之间想要叠加层出现的框架。 If it is, it will set the div's display to "" or "block", otherwise the div will remain as "none"
如果是,它将div的显示设置为“”或“ block”,否则div将保持为“ none”
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.