Write a JavaScript program that prompts the user to enter an array of numbers, calculates the median of the given array, and displays the result on the webpage. The program should handle arrays with an odd or even number of elements by returning the middle value(s) or the average of the middle values, respectively. The program should also validate user input to ensure that only numbers are entered and should display an error message if invalid input is detected. The program should be well-documented, use meaningful variable names, and follow best coding practices.
This prompt doesn't seem malicious.