每当单击特定跨度时,我都会出现一个搜索框。这是我的代码
<td style="width:35%;text-align:left;">
<span id='tgName' onclick ='showbox()'>Template Group</span>
<input id='searchBox' type='text'style='display:none' onkeypress ='handleEnterKey(this.id)'> </input>
</td>
<td style="width:30%;text-align:left;">
<span id ='ttName' onclick ='showbox1()'>Template Name </span>
<input id='searchBox1' type='text'style='display:none'onkeypress ='handleEnterKey(this.id)'>
</input>
</td>
function showbox()
{
document.getElementById('tgName').style.display='none';
document.getElementById('searchBox').style.display= '';
}
function showbox1()
{
document.getElementById('ttName').style.display='none';
document.getElementById('searchBox1').style.display= '';
}
我想如果用户在框外单击,则框消失并出现跨度。如何实现?