js現在のタイムコードを表示


jsコード
			function showTime(ele) {
				var d = new  Date();
				var year = d.getFullYear();
				var month = d.getMonth();
				var day = d.getDate();
				var hour = d.getHours();
				var mm = d.getMinutes();
				var ss = d.getSeconds();

				var strDate = year+"/" ;
				if(month<10)
					strDate +='0';
				strDate += month +"/";
				if(day<10)
					strDate += '0';
				strDate += day;
				strDate += " ";
				if(hour<10)
					strDate += '0';
				strDate += hour;
				strDate += ":";
				if(mm<10)
					strDate += '0';
				strDate += mm;
				strDate += ":";
				if(ss<10)
					strDate += '0';
				strDate += ss;
				document.getElementById(ele).innerHTML = strDate;
			}

			var id;
			function startTime(ele) {
				id = setInterval(showTime,1000,ele)
			}

			function stopTime() {
				if(id) {
					clearInterval(id);
				}
			}

html:
		<p >
			 :<span id ='time'>goole!!!!!</span>
		</p>
		<input type="button" name="kutei" value="start" onclick="startTime('time')">
		<input type="button" name="kutei" value="stop" onclick="stopTime()">