When you say
submit, you imply you are sending the values back to the server. If you want to use JavaScript to get the values out form fields and present them in an alert, this is what you might do:
<html>
<script>
function showValues()
{
alert(document.getElementById('txtMgs').value);
}
</script>
<body><form>
<input type="text" id="txtMsg" />
<input type="button" value="click me!" id="btnRun" onclick="showValues();" />
</form></body></html>