gpt4 book ai didi

javascript - 使用 javascript 突出显示字段

转载 作者:太空宇宙 更新时间:2023-11-04 04:33:09 25 4
gpt4 key购买 nike

我有点卡住了,尽管我的输入框由两部分组成,但我正在尝试重现您在 chrome 中专注于某个字段时获得的光芒。

这是我的代码: http://jsfiddle.net/spadez/vAfxw/9/

现在这就是我想要做的:

document.getElementById('location').onfocus=function(){
this.value='';
document.getElementById('searchContainer').style['border'] ='1px solid blue';
}

document.getElementById('location').onblur=function(){
document.getElementById('searchContainer').style['border'] ='none';
}

我应该用“searchContainer”包围我的字段和 div,还是应该将此 CSS 应用于字段和 div?基本上,我试图让整个位置框在被选中时发出蓝色光,而不仅仅是输入框。

最佳答案

您可能想看一下 CSS Outline property .

关于javascript - 使用 javascript 突出显示字段,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16900921/

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