清流,获取点击的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'); } }