Your code works. No need to modify onChange to onchange in the html (although it's good practice to use all lowercase in html). Html is not case-sensitive unlike Javascript.
Code:
<html>
<head>
<script type="text/javascript">
function getNewValue(inputhidden, textinput) {
var data = document.getElementById(inputhidden);
var text = document.getElementById(textinput);
data.value = text.value;
}
</script>
<body>
<form>
<input type= "text" name= "name" id= "name" onChange="getNewValue('detail',
'name')">
<input type= "hidden" name= "detail" id="detail" value= "">
</form>
</body>
</html>
After loading the page and typing something in the field, quickly verify that the hidden input's value changed by typing this in the browser's address bar and hitting Enter key:
Code:
javascript:alert(document.getElementById('detail').value)
It should alert the value entered in the 'name' field.