Skip to Content
JavaScript 经典实例:第三版
book

JavaScript 经典实例:第三版

by Adam D. Scott, Matthew MacDonald, Shelley Powers
September 2022
Intermediate to advanced
585 pages
8h 17m
Chinese
China Electric Power Press Ltd.
Content preview from JavaScript 经典实例:第三版
处理
HTML
341
另外,你还要考虑到
JavaScript
被禁用的情况,在服务器端为表单提供同等的反馈,
然后在单独的页面中呈现结果。
此外,必填的表单字段也要提前标记出来。在表单字段的标注中添加一个星号,并
指出带星号的表单字段是必填项。使用
aria-required
属性确保必填要求可被使用
辅助设备的用户知晓。使用
aria-required
,还建议使用
HTML5 required
属性,
启用浏览器原生验证。
12.17.4
参考
12.16
节介绍了简化表单验证的库和模块,还提到了
HTML5
表单验证技术。
12.18
保障自动更新区域的无障碍功能
12.18.1
问题
网页中有一个区域定期更新,例如列出最近更新文件的区域,或者展示某一话题最
新推文的区域。你想确保页面更新后,使用屏幕阅读器的人知道出现了新信息。
12.18.2
方案
为有更新的元素设置
WAI-ARIA
区域属性。
<div
id="update" role="log" aria-live="polite" aria-atomic="true"
aria-relevant="additions"
>
</div>
12.18.3
讨论
网页加载后,无须用户干预即可更新的区域,在
WAI-ARIA
中叫作
Live Regions
这算得上是最容易实现的
ARIA
功能,主动提供即时结果。而且,除了更新页面所
需的
JavaScript
之外,不涉及任何代码。
342
12
<div
id="update" role="log" aria-live="polite" ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

JavaScript

JavaScript

T. J. Crowder
JavaScript

JavaScript

David Flanagan
JavaScript Patterns

JavaScript Patterns

Stoyan Stefanov

Publisher Resources

ISBN: 9787519869601