This simple JS can't set the value of "para". I guess getElementByName doesn't work. But why?
<script>
function fn()
{
document.getElementById("para").setAttribute("name","hi");
document.getElementByName("hi").setAttribute("value","my value is high");
}
</script>
HTML:
<input type="button" onClick="fn()" value="click me">
<input id="para" type="text" />