diff options
Diffstat (limited to 'files/zh-cn/web/api/element/fullscreenerror_event')
-rw-r--r-- | files/zh-cn/web/api/element/fullscreenerror_event/index.html | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/files/zh-cn/web/api/element/fullscreenerror_event/index.html b/files/zh-cn/web/api/element/fullscreenerror_event/index.html new file mode 100644 index 0000000000..502df3c680 --- /dev/null +++ b/files/zh-cn/web/api/element/fullscreenerror_event/index.html @@ -0,0 +1,65 @@ +--- +title: Element.onfullscreenerror +slug: Web/API/Element/fullscreenerror_event +translation_of: Web/API/Element/onfullscreenerror +original_slug: Web/API/Element/onfullscreenerror +--- +<div>{{ApiRef("Fullscreen API")}}</div> + +<p><span class="seoSummary">{{domxref("Element")}} 接口的 <code><strong>onfullscreenerror</strong></code> 属性是在{{domxref("Element")}} 过渡到或退出全屏模式发生错误后处理事件{{event("fullscreenerror")}}的事件处理程序。</span></p> + +<h2 id="语法">语法</h2> + +<pre class="syntaxbox"><var>targetElement</var>.onfullscreenerror = <var>fullscreenErrorHandler</var>; +</pre> + +<h3 id="值">值</h3> + +<p>一个处理事件{{event("fullscreenerror")}}的事件处理程序.</p> + +<h2 id="示例">示例</h2> + +<p>本示例尝试不从用户发起的事件(如点击事件{{event("click")}}或键盘事件{{event("keypress")}})处理程序来触发全屏,由于全屏模式只允许由用户主动输入触发,因此该操作会发生错误,从而导致<span class="seoSummary">{{domxref("Element")}}会</span>触发{{event("fullscreenerror")}}事件传递给错误处理程序</p> + +<pre class="brush: js">let elem = document.querySelector("video")}} + +elem.onfullscreenerror = function ( event ) { + displayWarning("Unable to switch into full-screen mode."); +}; + +//.... + +elem.requestFullscreen();</pre> + +<h2 id="规范">规范</h2> + +<table class="standard-table"> + <tbody> + <tr> + <th scope="col">Specification</th> + <th scope="col">Status</th> + <th scope="col">Comment</th> + </tr> + <tr> + <td>{{SpecName("Fullscreen", "#dom-element-onfullscreenerror", "onfullscreenerror")}}</td> + <td>{{Spec2("HTML WHATWG")}}</td> + <td>Initial definition.</td> + </tr> + </tbody> +</table> + +<h2 id="浏览器兼容性">浏览器兼容性</h2> + + + +<p>{{Compat("api.Element.onfullscreenerror")}}</p> + +<h2 id="其他">其他</h2> + +<ul> + <li><a href="/en-US/docs/Web/API/Fullscreen_API">Fullscreen API </a></li> + <li><a href="/en-US/docs/Web/API/Fullscreen_API/Guide">Guide to the Fullscreen API</a></li> + <li>{{event("fullscreenerror")}}</li> + <li>{{domxref("Element.onfullscreenchange")}}</li> + <li>{{domxref("Document.onfullscreenerror")}}</li> +</ul> |