English 中文(简体)
利用浏览器的存取钥匙,强调与存取钥匙的所有联系的特性
原标题:using access key for browser to underline the first character of all links with access keys

我正试图说明如何利用很少获得关键链接的接入钥匙,并强调网页上的所有链接在接驳钥匙时的首要性质。

i.e. when the person presses alt in IE and Chrome all of the first letters of the links underline letting the person know which key to press. Also is there anyway to do it by creating a universal [access key] for all browsers using javascript or are you forced to use the multiple methods for each browser and thus stuck writing a class for each browser?

我发现一种使用<代码><span>围绕特性使用的方法,但是,这似乎只是好的做法,而且,如果很少能够 gr取接触钥匙,在联系中强调该信并用强调该信的话,那将是空洞的。

非常感谢任何帮助。

最佳回答
var labels= document.getElementsByTagName( label );
for (var i= labels.length; i-->0;) {
    var label= labels[i];
    if (!label.htmlFor) continue;
    var field= document.getElementById(label.htmlFor);
    if (!field) continue;
    if (!field.accessKey) continue;
    var ix= label.firstChild.data.toLowerCase().indexOf(field.accessKey.toLowerCase());
    if (ix===-1) continue;
    var next= label.firstChild.splitText(ix+1);
    var span= document.createElement( span );
    span.className=  accesshighlight ;
    span.appendChild(label.firstChild.splitText(ix));
    label.insertBefore(span, next);
}

这将在标签上的第一份配对信标上打上<代码><span par=“accesshighlight”>,假定标签含有文字内容,而不是更多的内容(如果你需要寻找比照案文,使小数更耗时)。 然后,你可以说:

body.showhighlights .accesshighlight {
    text-decoration: underline;
}

http://www.un.org/Depts/DGACM/index_chinese.htm 当带被压。

问题回答

暂无回答




相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签