简体   繁体   English

在Mechanical Turk中播放音频的按钮

[英]Buttons to play Audio in Mechanical Turk

We would like to integrate audio in an Amazon Mechanical Turk HIT, with buttons to play and increase or decrease volume. 我们想将音频集成到Amazon Mechanical Turk HIT中,并带有播放和增大或减小音量的按钮。

<audio id="player" src="test.mp3"></audio> 
<button onclick="document.getElementById('player').play()">Play</button> 
<button onclick="document.getElementById('player').volume += 0.1">Vol+ </button>  
<button onclick="document.getElementById('player').volume -= 0.1">Vol- </button>

The problem is that any button press is also interpreted as a Submit and the HIT is submitted. 问题在于,任何按钮按下也将被解释为“提交”,并且HIT将被提交。 How can that be avoided? 如何避免呢?

Uh, it seems like this is just being caused by a lack of understanding of the HTML <button> tag, not anything to do with Mechanical Turk. 嗯,这似乎是由于对HTML <button>标记缺乏了解导致的,与Mechanical Turk无关。

All buttons submit a form by default unless they have the attribute type="button" . 默认情况下,所有按钮都将提交表单,除非它们具有属性type="button"

This is because, according to the HTML 4.01 specification , the default button type is submit . 这是因为, 根据HTML 4.01规范 ,默认按钮类型为submit

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM