在ondrop事件中调用focus()时使光标闪烁,可以通过以下步骤实现:
<input type="text" id="myInput" ondrop="drop(event)" ondragover="allowDrop(event)">
function allowDrop(event) {
event.preventDefault();
}
function drop(event) {
event.preventDefault();
var input = document.getElementById("myInput");
input.focus();
setInterval(function() {
input.style.visibility = (input.style.visibility == 'hidden' ? '' : 'hidden');
}, 500);
}
这样,在ondrop事件中调用focus()时,光标将开始闪烁,以提醒用户当前文本框获得了焦点。
腾讯云相关产品和产品介绍链接地址:
领取专属 10元无门槛券
手把手带您无忧上云