* *在页面加载后2分钟后设置一个警告框* [英] * * Set an alert box after 2mins from page load*

查看:52
本文介绍了* *在页面加载后2分钟后设置一个警告框*的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨朋友们,

我想在页面加载2分钟后设置一个警告框。



这可能吗?

Hi friends,
I want to set one alert box after 2mins from page load.

is this possible?

推荐答案

是的,你可以这样做。



将你的HTML'body'标记更改为:



Yes, you can do this.

Change your HTML 'body' tag to:

<body onload="startTimer();">





然后在你的页面标题中:





And then in your page header:

<script type="text/javascript">

	function startTimer()
	{
		// show an alert after 120 seconds
		var t=setTimeout(function(){alert("Some alert message")},120000);
	}

</script>


您可以通过这种方式刷新页面的特定时间间隔:

You can refresh your page for specific time intervals this way:
<meta http-equiv="Refresh" content="120; url=http://your.new/url/here" />



这将在每'120'秒刷新页面,在页面加载时添加逻辑。

参考:按特定时间间隔刷新/重新加载页面[ ^ ]


请参阅以下两个链接并修改两个链接中提供的代码。



Timer.Start方法 [ ^ ]



在页面加载时启动计时器。 [ ^ ]





问候......:笑:
Refer to below two links and modify the code provided in both of the links.

Timer.Start Method[^]

Start timer when page has loaded.[^]


Regards...:laugh:


这篇关于* *在页面加载后2分钟后设置一个警告框*的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆