以下是我在 JavaScript 中编写了一个函数并尝试在音频标签的 src 元素中调用它的代码。还想知道是否返回“ http://translate.google.com/translate_tts?tl=en&q=this is a test”+文件;
statement is ok to get google TTS audio file?
<html>
<body>
<script language="javascript" type="text/javascript">
function myFunction()
{
var File = "this is a test";
return "http://translate.google.com/translate_tts?tl=en&q=this is a test" + File;
}
</script>
<audio id="speech" src="javascript:myFunction();" controls="controls" autoplay="autoplay"></audio>