我有一些代碼,使用輸入標籤備案錄音機和停止按鈕:HTML改變輸入標籤按鈕標籤
<input type="button" class="start" value="Record" />
<input type="button" class="stop" value="Stop" />
我想改變那些輸入標籤<按鈕>標籤執行相同的功能,但我不知道如何。代碼使用jquery,我認爲代碼中的實際功能是用jquery編寫的。下面是我認爲執行「開始」和「停止」功能的代碼部分:
$('.recorder .start').on('click', function() {
$this = $(this);
$recorder = $this.parent();
navigator.getUserMedia({audio: true}, function(stream) {
var recorderObject = new MP3Recorder(audio_context, stream, { statusContainer: $recorder.find('.status'), statusMethod: 'replace' });
$recorder.data('recorderObject', recorderObject);
recorderObject.start();
}, function(e) { });
});
$('.recorder .stop').on('click', function() {
$this = $(this);
$recorder = $this.parent();
recorderObject = $recorder.data('recorderObject');
recorderObject.stop();
該方案有其他.js文件,它使用時,需要這樣也許更多關於他們的信息來回答這個問題。我嘗試以下,但他們沒有工作:
<button onclick="start()">Record</button>
<button class="start">Record</button>
是你'<按鈕類= 「開始」>記錄''裏面元素.recorder'? – Lekhnath 2014-12-04 16:47:39