Home  >  Article  >  Web Front-end  >  HTML5 adds voice input function to the input box

HTML5 adds voice input function to the input box

巴扎黑
巴扎黑Original
2017-03-19 13:57:333452browse

[Introduction] Here we introduce the powerful functions of HTML that you will use in the future. You can directly add voice functions to the input box. Let's take a look at the implementation method first. You can see the microphone icon on the right side of the input box. Click on the microphone to perform speech recognition. It is actually very simple. Speech recognition is the basis of HTML5

Here are the powerful HTML functions that you will use in the future. You can directly add voice function to the input box. Let's take a look at the implementation method first.

You can see the microphone icon on the right side of the input box. Click on the microphone to perform speech recognition.

HTML5 adds voice input function to the input box

It is actually very simple. Speech recognition is based on HTML5. Basic function, its usage is


If you like XHTML-like syntax, you can express it like this

< ;input type=”text” x-webkit-speech=”x-webkit-speech” />
Speech recognition was something that was incredible ten years ago. Even a few years ago, speech on web pages Recognition can only be achieved using other methods, such as using Flashplayer and so on. But now, to obtain the voice, you only need to simply add an attribute tag to the input box, and it can be recognized.

Mobile devices such as browsers on mobile phones should also support speech recognition as long as they support html5. Try browsing this page on your Android?

In addition, if you want to use javascript to get the end of the speech recognition event, you can use onwebkitspeechchange

The above is the detailed content of HTML5 adds voice input function to the input box. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn