<body>
脚本无效
<script>
function show(inp,spanId){
var msg=document.getElementById(spanId);
msg.innerHTML="<font color="red" size="6">",inp.id;
}
function hide(spanId){
var msg=document.getElementById(spanId);
msg.innerHTML="";
}
</script>
功能无法正常工作
<input type='text' id='name' onmouseover="show(this,namemessage)" onmouseout="hide(namemessage)" />
<span id='namemessage'></span>
<br/>
<input type='text' id='email' onmouseover="show(this,emailmessage)" />
<span id='emailmessage'></span>
<body>
function show(inp, spanId) {
var msg = document.getElementById(spanId);
msg.innerHTML = '<font color="red" size="6">'+inp.id+'</font>';
}
function hide(spanId) {
var msg = document.getElementById(spanId);
msg.innerHTML = "";
}
&#13;
<input type='text' id='name' onmouseover="show(this,'namemessage')" onmouseout="hide('namemessage')" />
<span id='namemessage'></span>
<br/>
<input type='text' id='email' onmouseover="show(this,'emailmessage')" />
<span id='emailmessage'></span>
&#13;
答案 0 :(得分:0)
我不知道你想用这段代码做什么,但你的代码中有很多错误。 检查下面的代码没有错误
<input type='text' id='name' onmouseover="return show(this,'namemessage')" onmouseout="return hide('namemessage')" />
<span id='namemessage'></span>
<br/>
<input type='text' id='email' onmouseover="return show(this,'emailmessage')" />
<span id='emailmessage'></span>
<script>
function show(inp,spanId){
var msg=document.getElementById(spanId);
msg.innerHTML='<font color="red" size="6">'+inp.id+'</font>';
}
function hide(spanId){
var msg=document.getElementById(spanId);
msg.innerHTML="";
}
</script>