我在每个输入中有 2 个输入和图像。当我单击输入中的图像时,我只想清除此输入中的文本。这要怎么做?
这是我的功能
function deleteText (id)
{
//here i should get txtNameFirm ot txtNameOwner
var element = document.getElementsById(id);
element.value=" ";
}
HTML
<div class="outer" >
<input type="text" id = "txtNameOwner" value="ENTER NAME OF OWNER" />
<img src="file:///C:/Users/gismo2/Dropbox/GISmoBusinessCatalogProject-Feb2013/IconResources/close_btn.png" onclick="deleteText('txtNameOwner')/>
</div>
<div class="outer" >
<input type="text" id = "txtNameFirm" value="ENTER NAME OF FIRM" />
<img src="file:///C:/Users/gismo2/Dropbox/GISmoBusinessCatalogProject-Feb2013/IconResources/close_btn.png" onclick="deleteText('txtNameFirm')" />
</div>