问题描述
我不是很擅长Javascript和jQuery,我想把倒数计时器添加到我的网页,所以我按照这个链接中提到的步骤进行操作: []
它运行良好,但是我想在倒计时达到0之后调用一个函数将我重定向到另一个页面但是我我不知道在哪里添加这个函数,以及我应该在jQuery插件的javascript文件中调用什么函数来处理这个问题。
I''m not so good at Javascript and jQuery and i want to addw countdown timer to my web page so i followed the steps mentioned in this link : http://www.1stwebdesigner.com/css/create-coming-soon-page-using-html5-and-css3/[^]
and it works good, but i want to call a function to redirect me to another page after the countdown reached to 0 but i don''t know where to add this function, and what function i should call in the javascript file from the jQuery plug-in to handle this issue.
推荐答案
function countdown(remsec)//remsec in second
{
if(remsec==-1) //cause it will display until zero
{
window.location='the_location_you_want_to_go.html';
return ;
}
delay=remsec*1000;
并根据您所需的操作调用倒计时功能;例如:
and call the countdown function from your desired action; as example:
<input type="button" value="download" onclick="countdown(5)" />
这篇关于倒数计时器jQuery后调用函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!