html:
<table>
<tr>
<td id="a1"></td>
</tr>
</table>
JS:
<script type="text/javascript">
function onloadEvent(){
var _td = document.getElementById("a1");
var _img = document.createElement("img");
_img.setAttribute("id", "floatImage");
_img.setAttribute("src", "icon.png");
_img.setAttribute("onclick", "clickImage()");
_img.onclick = function(){ //点击时响应事件
alert("点击");
//window.location = "http://baidu.com"; 跳转url
};
_td.appendChild(_img);
}
</script>