Javascript button to call custom fields data

Is this something you wish to achieve?

<!DOCTYPE html>
<html>
<body>

<h1>My First JavaScript</h1>

<button type="button"
     onclick="var the_id=document.getElementById('my_field').value;
        document.getElementById('demo').innerHTML=
        document.getElementById(the_id).innerHTML;">
Click me to display some other string.</button>

<p id="demo"></p>

<input id="my_field" type="text"></a>

<div id="someother">Hi there!</div>

</body>
</html>