现在的位置: 首页 > 综合 > 正文

HTML5-语音搜索框

2017年12月26日 ⁄ 综合 ⁄ 共 319字 ⁄ 字号 评论关闭
<html>
<head>
	<script>
	function echoSpeakContent(){
		var objVal = document.getElementById('speakInput').value;
		alert(objVal);
	}
	</script>
	<title>html5-speaking</title>
</head>
	<body>
		<input x-webkit-speech x-webkit-grammar="bUIltin:search" lang="zh-CN" onwebkitspeechchange="echoSpeakContent();" id="speakInput"/>
	</body>
</html>

在Chrome中的效果如下

抱歉!评论已关闭.