Sorry a simple enough action but just cant get it valid, the following code works find but not valid because of the form name so change name to id and then what? here i am stuck. help please

function showName(){
var name = document.nameForm.name.value;
window.alert("Hello " + name + "welcome to my site");
}

<h2>Display Name</h2>
<form name="nameForm" action="#">
<p>Name: <input type="text" name="name" /><br /><br />
<input type="submit" value="Display" onclick="showName();" /></p>
</form>