单击文本框时,如何清除javascript中的成功消息

单击文本框时,如何清除javascript中的成功消息,javascript,Javascript,当我使用“提交”按钮提交数据时,我收到“已成功插入”消息。单击文本框时,我需要清除此消息。如何清除此消息 谢谢你要正确地帮助你,你应该发布一些你实际编写的代码 根据您所提供的信息,我可以假设您可以执行以下操作: window.onload=function(){ var elArr=document.querySelectorAll('input[type=text]'); for(变量i=0,len=elArr.length;i

当我使用“提交”按钮提交数据时,我收到“已成功插入”消息。单击文本框时,我需要清除此消息。如何清除此消息


谢谢你

要正确地帮助你,你应该发布一些你实际编写的代码

根据您所提供的信息,我可以假设您可以执行以下操作:

window.onload=function(){
var elArr=document.querySelectorAll('input[type=text]');
for(变量i=0,len=elArr.length;i
span{
颜色:红色;
显示:块;
}


成功为了正确地帮助您,您应该发布一些实际编写的代码

根据您所提供的信息,我可以假设您可以执行以下操作:

window.onload=function(){
var elArr=document.querySelectorAll('input[type=text]');
for(变量i=0,len=elArr.length;i
span{
颜色:红色;
显示:块;
}


成功试试这个

<input id="textbox1" type="text"  onmouseenter="clearSuccessLabel()" >
<input id="textbox2" type="text"  onmouseenter="clearSuccessLabel()" >
<input id="textbox3" type="text"  onmouseenter="clearSuccessLabel()" >
<input id="textbox4" type="text"  onmouseenter="clearSuccessLabel()" >
<input id="textbox5" type="text"  onmouseenter="clearSuccessLabel()" >
<span id="alert">Success!</span>

function clearSuccessLabel() 
{
  document.getElementById('alert').innerHTML = "";
}

成功!
函数clearSuccessLabel()
{
document.getElementById('alert').innerHTML=“”;
}

试试这个

<input id="textbox1" type="text"  onmouseenter="clearSuccessLabel()" >
<input id="textbox2" type="text"  onmouseenter="clearSuccessLabel()" >
<input id="textbox3" type="text"  onmouseenter="clearSuccessLabel()" >
<input id="textbox4" type="text"  onmouseenter="clearSuccessLabel()" >
<input id="textbox5" type="text"  onmouseenter="clearSuccessLabel()" >
<span id="alert">Success!</span>

function clearSuccessLabel() 
{
  document.getElementById('alert').innerHTML = "";
}

成功!
函数clearSuccessLabel()
{
document.getElementById('alert').innerHTML=“”;
}

请发布您迄今为止所做的工作。我们需要查看代码以便能够提供帮助。请发布到目前为止您所做的工作。我们需要查看代码以便我们能够提供帮助。嗨,@doutriforce,谢谢你的帮助,但是你的单个文本框代码,但我有五个文本框。在这种情况下,我如何才能获取Hi,@doutriforce,谢谢你的帮助,但是你的单个文本框代码,但是我有五个文本框。在这种情况下,我如何获取你的解决方案在单击时不清除消息,这就是他要求的。此外,将事件绑定到元素而不是在标记上声明更安全。您的解决方案不会在单击时清除消息,这是他要求的。此外,将事件绑定到元素比在标记上声明事件更安全。