gieson倒计时的示例用法如下。没关系。
<body>
<script src="countdown.js" type="text/javascript"></script>
<script type="application/javascript">
var myCountdown2 = new Countdown({time: 30000, width:200, height:80, rangeHi:"hour"});
</script>
</body>
我想在按钮onclick时开始倒计时。但不行。
<body>
<script src="countdown.js" type="text/javascript"></script>
<script type="application/javascript">
var myCountdown2;
function startCount() {
myCountdown2 = new Countdown({time: 30000, width:200, height:80, rangeHi:"hour"});
}
</script>
<input type="button" value="start" onclick="startCount();"/>
</body>
我该如何解决?我没有javascript
经验。
错误:
Error in parsing value for 'size'. Declaration dropped.
答案 0 :(得分:0)
尝试将myCountDown2
保存在全局范围内。
答案 1 :(得分:0)
我测试了它并且工作正常
<body style="background-color:#EDEDED">
<p onClick="return countIt();">Example 1 - Time until April 1, 2016</p>
<!-- START COUNTDOWN -->
<script src="countdown.js" type="text/javascript"></script>
<script type="application/javascript">
function countIt(){
var myCountdownTest = new Countdown({
time: 30000, width:200, height:80, rangeHi:"hour"
});
}
</script>