Track srclang attribute
Definition and Usage
srclang
The attribute sets or returns the value of the srclang attribute of the track.
The HTML srclang attribute specifies the language of the track text data.
If kind="subtitles", this attribute is required.
Tip:To view all available language codes, please visit ourLanguage Code Reference Manual.
See also:
HTML Reference Manual:HTML <track> srclang 属性
Instance
Example 1
Get the language code of the track text data:
var x = document.getElementById("myTrack").srclang;
The result of x may be:
en
Example 2
Change the language code of the track text data:
document.getElementById("myTrack").srclang = "no";
Syntax
Return nglang attribute:
trackObject.srclang
Set ng attribute nglang:
trackObject.srclang = language_code
属性值
值 | 描述 |
---|---|
language_code | 规定两个字母的语言代码,用于规定轨道文本数据的语言。 |
技术细节
返回值: | 字符串值,表示文本轨道数据的语言代码。 |
---|
浏览器支持
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
支持 | 10.0 | 不支持 | 不支持 | 支持 |