【问题标题】:using accesskey across the element in other iframe is not working in Chrome在其他 iframe 中的元素上使用 accesskey 在 Chrome 中不起作用
【发布时间】:2012-10-27 15:00:47
【问题描述】:

在 chrome 中,我专注于“A”iframe。其他 iframe 上有元素设置 accesskey 属性。我不能使用 accesskey 来关注元素。 IE,FF不存在这个问题。

有什么技巧可以解决这个问题吗?我的代码如下:

index.html:

<!doctype html>
<head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8">
    <title>Index</title>
</head>
<body>
    <input type="text"  accesskey="b" name="some_name" value="">
    <iframe src="a.html"></iframe>
    <iframe src="b.html"></iframe>
</body>

a.html:

<!doctype html>
<head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8">
    <title>Index</title>
</head>
<body>
    <input type="text"  accesskey="e" name="some_name" value="">
</body>

b.html:

<!doctype html>
<head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8">
    <title>Index</title>
</head>
<body>
    <input type="text"  accesskey="t" name="some_name" value="">
</body>

【问题讨论】:

    标签: html google-chrome iframe accessibility access-keys


    【解决方案1】:

    问题与当前关注的上下文有关。因此,如果用户没有在相应的 iframe 内单击,则访问密钥将不起作用。实现这一点的一种方法是触发 javascript keyevent,它将键事件转发到每个 iframe 中,直到它满足相应的访问键属性。

    【讨论】:

      猜你喜欢
      • 2014-12-20
      • 2021-07-21
      • 1970-01-01
      • 1970-01-01
      • 2011-03-07
      • 1970-01-01
      • 1970-01-01
      • 2015-08-31
      • 1970-01-01
      相关资源
      最近更新 更多