前端上将字符串用语音读出来只能在IE上运行 其他不行 代码极少

先保存保存自己的笔记 有高手看到求指点

 1  <script type="text/javascript">
 2         var VoiceObj;
 3         try {
 4             VoiceObj = new ActiveXObject("Sapi.SpVoice");
 5         }
 6         catch (e) {
 7             VoiceObj = null;
 8         }
 9         function InitializeControls() {
10             var VoicesToken = VoiceObj.GetVoices();
11             var AudioOutputsToken = VoiceObj.GetAudioOutputs();
12         }
13         if (null != VoiceObj) {
14             InitializeControls();
15         }
16         function SpeakText(strMsg) {
17             try {
18                 VoiceObj.Speak(strMsg, 1);
19 
20             }
21             catch (exception) {
22                 alert("Error");
23             }
24         }
25         function myClose() {
26             delete VoiceObj;
27         }
28         $(function () {
29             var ab = "111111111112333333";
30 })
31 </script>
View Code
原文地址:https://www.cnblogs.com/weivvei/p/4126749.html