We would like to know how to set the display value of any DOM element.
<!DOCTYPE html>
<html>
<head>
<script type='text/javascript'>
window.onload=function(){<!--from www. ja v a 2 s .c o m-->
var els = ['p', 'div', 'li', 'a', 'input', 'textarea'];
for (var i in els) {
var el = document.createElement(els[i]);
el.value = 'foo';
console.log(el.value);
}
}
</script>
</head>
<body>
</body>
</html>
The code above is rendered as follows: