該場景是即時獲取來自用戶的輸入並需要爲該文本提供音頻。來自用戶的輸入存儲在變量中。如何給變量的值,以谷歌TTS將文本轉換爲變量
<html>
<head>
<script src="jquery.js"></script>
<script>
function myfunction()
{
$("#div_style").html($("#text_area_id").val());
if(typeof(Storage)!=="undefined")
{
localStorage.lase=$("#text_area_id").val();
document.getElementById("div_style").innerHTML=" " + localStorage.lase;
var audio = new Audio();
audio.src ='http://translate.google.com/translate_tts?ie=utf-8&tl=en&q=localStorage.lase;
audio.play();
}
}
</script>
</head>
<body>
<form name="myform">
<textarea name="text_area" id="text_area_id" rows="2" cols="16"></textarea>
</form>
<input type="button" onclick="myfunction()" value="save" />
<div style="color:red" id="div_style">
</div>is certified.
</body>
</html>
與Java無關。 -1不讀取有用的標記彈出窗口。 – 2013-05-12 11:03:36
@AndrewThompson okies。你可以幫忙嗎? – 2013-05-12 11:06:06
*「你可以幫忙嗎?」*請使用正確的拼寫爲'你','你的'和'請''。這使人們更容易理解和幫助。 – 2013-05-12 11:22:53