こんにちはガイズアンドギャルズ、私は(1)JavaScriptのカウントダウン関数(2)php変数のターゲット日付(たとえば、ユーザーが「開始」をクリックしてから4秒後)を受け入れるカウントダウン関数(3)onclick()を使用しようとしていますstopstart() 関数と updateAlarmTime() 関数の両方を実行します。
これは私が基本コードに使用するものです: http://stopwatch.onlineclock.net/
私のメインphpページには次のものがあります:
<script src="js/stopwatch.js" type="text/javascript"></script>
<?php $alarmsecond2=4; ?>
<form name='stopwatch'....
<input type='button' onclick='stopstart()' onfocus='this.blur()'
name='startstopbutton' id='startstopbutton' ... value='Start'>
</form>
stopstart() は上記のように機能し、updateAlarmTime() はプルダウン選択メニューを使用して $alarmsecond2 などの時間変数を設定すると機能しますが、それは望ましくありません。
1 つの onclick() で stopstart() と updateAlarmTime('') を呼び出してみましたが、stopstart のみが実行されます。onclick() で stopstart() と updateAlarmTime() の両方を呼び出す関数を呼び出してみましたが、それも機能しませんでした。
stopwatch.js には次のものがあります。
function stopstart() {
t[t[2]]=(new Date()).valueOf();
t[2]=1-t[2];
if (0==t[2]) {
clearInterval(t[4]);
t[3]+=t[1]-t[0];
document.getElementById("startstopbutton").value="Start";
document.getElementById('split').innerHTML+=
(t[7]++)+' Stop: '+format(t[1]-t[0])+'<br>';
t[4]=t[1]=t[0]=0;
disp();
firstsplitflag = 0;
} else {
document.getElementById("startstopbutton").value="Stop";
t[4]=setInterval(disp, 43);
}
//GA
urchinTracker('http://stopwatch.onlineclock.net/conversions/stopstartbutton');
}
function updateAlarmTime()
{
var hour1 = alarmhour1;
var hour2 = ahour2;
var minute1 = aminute1;
var minute2 = aminute2;
var second1 = asecond1;
var second2 = asecond2;
var second_10th = asecond_10th;
var second_100th = asecond_100th;
var second_1000th = asecond_1000th;
alarmTime = (hour1 + hour2 + minute1 + minute2 + second1 +
second2 + second_10th + second_100th + second_1000th);
}
3 つの目標を達成するにはどうすればよいですか?
助けてくれてありがとう。