php一个简单的功能,求源代码
要求:一个按钮上有倒数功能,倒数5秒才能按.我是大菜鸟,望高手帮编.比如论坛注册时就有这样的功能,倒数10数才能确定.可以参考:http://www.discuz.net...
要求:一个按钮上有倒数功能,倒数5秒才能按.我是大菜鸟,望高手帮编.
比如论坛注册时就有这样的功能,倒数10数才能确定.
可以参考:http://www.discuz.net/register.php 展开
比如论坛注册时就有这样的功能,倒数10数才能确定.
可以参考:http://www.discuz.net/register.php 展开
3个回答
展开全部
复制下面的代码,保存运行,在form里的内容自己随便改:
<body>
<FORM name=bbrules action=register.php method=post>
<TABLE cellSpacing=1 height=200 cellPadding=4 width="100%" align=center>
<tr><td></td></tr>
<tr><td> <INPUT class=button style="HEIGHT: 23px" type=submit value="同 意" name=rulesubmit>
<INPUT class=button style="HEIGHT: 23px" onclick=javascript:history.go(-1); type=button value=不同意 name=return>
</td></tr>
</FORM>
</table>
</body>
<SCRIPT type=text/javascript>
var secs = 5;
var wait = secs * 1000;
document.bbrules.rulesubmit.value = "同 意(" + secs + ")";
document.bbrules.rulesubmit.disabled = true;
for(i = 1; i <= secs; i++) {
window.setTimeout("update(" + i + ")", i * 1000);
}
window.setTimeout("timer()", wait);
function update(num, value) {
if(num == (wait/1000)) {
document.bbrules.rulesubmit.value = "同 意";
} else {
printnr = (wait / 1000) - num;
document.bbrules.rulesubmit.value = "同 意(" + printnr + ")";
}
}
function timer() {
document.bbrules.rulesubmit.disabled = false;
document.bbrules.rulesubmit.value = "同 意";
}
</SCRIPT>
<body>
<FORM name=bbrules action=register.php method=post>
<TABLE cellSpacing=1 height=200 cellPadding=4 width="100%" align=center>
<tr><td></td></tr>
<tr><td> <INPUT class=button style="HEIGHT: 23px" type=submit value="同 意" name=rulesubmit>
<INPUT class=button style="HEIGHT: 23px" onclick=javascript:history.go(-1); type=button value=不同意 name=return>
</td></tr>
</FORM>
</table>
</body>
<SCRIPT type=text/javascript>
var secs = 5;
var wait = secs * 1000;
document.bbrules.rulesubmit.value = "同 意(" + secs + ")";
document.bbrules.rulesubmit.disabled = true;
for(i = 1; i <= secs; i++) {
window.setTimeout("update(" + i + ")", i * 1000);
}
window.setTimeout("timer()", wait);
function update(num, value) {
if(num == (wait/1000)) {
document.bbrules.rulesubmit.value = "同 意";
} else {
printnr = (wait / 1000) - num;
document.bbrules.rulesubmit.value = "同 意(" + printnr + ")";
}
}
function timer() {
document.bbrules.rulesubmit.disabled = false;
document.bbrules.rulesubmit.value = "同 意";
}
</SCRIPT>
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
<HTML>
<HEAD>
<script>
var time_show = 4;
var timename = setInterval("sec_inner()",1000);
function g(x)
{
return window.document.getElementById(x);
}
function sec_inner()
{
g('radio_num').value = 'button['+time_show+']';
if(time_show == 0)
{
clearTimeout(timename);
g('radio_num').disabled = '';
}
time_show = time_show - 1;
}
</script>
</HEAD>
<BODY>
<input type="button" id="bb" name="radio_num" value="button[5]" onclick="if(window.confirm('确认注册?')){alert('那就注册吧');}" disabled>
</BODY>
</HTML>
实验过了,可以用的。
<HEAD>
<script>
var time_show = 4;
var timename = setInterval("sec_inner()",1000);
function g(x)
{
return window.document.getElementById(x);
}
function sec_inner()
{
g('radio_num').value = 'button['+time_show+']';
if(time_show == 0)
{
clearTimeout(timename);
g('radio_num').disabled = '';
}
time_show = time_show - 1;
}
</script>
</HEAD>
<BODY>
<input type="button" id="bb" name="radio_num" value="button[5]" onclick="if(window.confirm('确认注册?')){alert('那就注册吧');}" disabled>
</BODY>
</HTML>
实验过了,可以用的。
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询