我想添加一个图像,做下面的代码的等价物,但不是创建一个textnode我将如何创建一个图像元素?如何将图像添加到跨度子元素?
//create the DOM object
var newSpan = document.createElement('span');
// add the class to the 'span'
newSpan.setAttribute('class', 'ABC');
document.getElementById('text').appendChild(newSpan);
var selectedTextNode = document.createTextNode();
newSpan.appendChild(selectedTextNode);