Create a JavaScript program that checks if a given number is a prime number and handles cases where the input is not a valid integer gracefully, displaying an appropriate error message. The program should take input from the user and display the result.
function isPrime(num) { if (num === 1) { return false; } else if (num === 2) { return true; } else { for (var i = 2; i < num; i++) { if (num % i === 0) { return false; } } return true; } }