gpt4 book ai didi

asp.net - onfocus ="this.blur();"问题

转载 作者:塔克拉玛干 更新时间:2023-11-02 22:55:41 26 4
gpt4 key购买 nike

// I am trying to apply an "onfocus="this.blur();"" so as to remove the dotted border lines around pics that are being clicked-on
// the effect should be applied to all thumb-nail links/a-tags within a div..

// sudo code (where I am):
$(".box a").focus( // so as to effect only a tags within divs of class=box | mousedown vs. onfocus vs. *** ?? | javascript/jquery... ???
function ()
{
var num = $(this).attr('id').replace('link_no', '');
alert("Link no. " + num + " was clicked on, but I would like an onfocus=\"this.blur();\" effect to work here instead of the alert...");

// sudo bits of code that I'm after:
// $('#link_no' + num).blur();
// $(this).blur();
// $(this).onfocus = function () { this.blur(); };


}
);

// the below works for me in firefox and ie also, but I would like it to effect only a tags within my div with class="box"
function blurAnchors2()
{
if (document.getElementsByTagName) {
var a = document.getElementsByTagName("a");
for (var i = 0; i < a.length; i++) {
a[i].onfocus = function () { this.blur(); };
}
}
}

最佳答案

谢谢大家 - 我已经开始使用 css(a:focus):

img, a:focus{
outline: none;
}

它似乎工作正常(制表符仍然有效,点击时边框消失)对我来说......在 ie 和 firefox 中。现在必须改造一些其他链接才能使用它...

再次感谢。

关于asp.net - onfocus ="this.blur();"问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2446769/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com