如何在网页中加载几秒后自动显示一个弹出框? [英] How to display a popup box automatically after few seconds of pageload in a webpage?
本文介绍了如何在网页中加载几秒后自动显示一个弹出框?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
我正在使用C#在asp.net上做一个网站。在主页加载几秒钟后,我希望弹出窗口显示一些文字,图片和按钮。在弹出窗口中将有2个按钮,其中1个将关闭弹出窗口,另一个将用户重定向到另一个具有值的页面。怎么做到这一点?请帮忙...
谢谢。
Hi Guys,
I am doing a website in asp.net using C#. I want to a popup to appear with some text, picture and buttons after few seconds after the homepage loads. In the popup there will be 2 buttons, 1 of which will close the popup, the other will redirect user to another page with a value. How to achieve this? Please help...
Thanks.
推荐答案
你好Aritra Nath,
您可以使用JavaScript函数setTimeout在3秒后执行代码。
您可以在函数中定义弹出窗口的代码。
var t = setTimeout(popupFunction,3000);
函数popupFunction()
{
警报(弹出);
}
问候,
Sunil
Hello Aritra Nath,
You can use JavaScript function setTimeout for executing a code after 3 seconds.
Your code for popup window can be defined within the function.
var t=setTimeout(popupFunction,3000);
function popupFunction()
{
alert("popup");
}
with regards,
Sunil
这篇关于如何在网页中加载几秒后自动显示一个弹出框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文