清流,获取点击的img路径

清流:

<div style="clear:both"></div>

获取img的路径到TextBox3内;

 

//获取展示的头像的集合
var
_heads = document.getElementsByClassName("heads_item"); for (var i = 0; i < _heads.length; i++) { _heads[i].onclick = function () { for (var j = 0; j < _heads.length; j++) { _heads[j].style.backgroundColor = ""; } this.style.backgroundColor = 'red';
//获取点击的img的路径 document.getElementById(
'TextBox3').value = this.getElementsByTagName('img')[0].getAttribute('src'); } }

 

 

 

 

posted @ 2017-12-16 23:57  _Iniesta  阅读(370)  评论(0编辑  收藏  举报