我有点卡住了,尽管我的输入框由两部分组成,但我正在尝试重现您在 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/