Edit in JSFiddle

<input type="file" name="file" id="file">
<br/>
<input type="button" value="Upload" onclick="return CheckDimension()" />
<br/>
<br/>
Width: <span id='width'></span><br/>
Height: <span id='height'></span>
    
 <script type="text/javascript">
function CheckDimension() {
    //Get reference of File.
    var fileUpload = document.getElementById("file");
 
    //Check whether the file is valid Image.
    var regex = new RegExp("([a-zA-Z0-9\s_\\.\-:])+(.jpg|.png|.gif)$");
    if (regex.test(fileUpload.value.toLowerCase())) {
 
        //Check whether HTML5 is supported.
        if (typeof (fileUpload.files) != "undefined") {
            //Initiate the FileReader object.
            var reader = new FileReader();
            //Read the contents of Image File.
            reader.readAsDataURL(fileUpload.files[0]);
            reader.onload = function (e) {
                //Initiate the JavaScript Image object.
                var image = new Image();
 
                //Set the Base64 string return from FileReader as source.
                image.src = e.target.result;
                       
                //Validate the File Height and Width.
                image.onload = function () {
                    var height = this.height;
                    var width = this.width;
                    if (height > 200 || width > 200) {
                    //show width and height to user
                       document.getElementById("width").innerHTML=width;
                       document.getElementById("height").innerHTML=height;
                        alert("Height and Width must not exceed 200px.");
                        return false;
                    }
                    alert("Uploaded image has valid Height and Width.");
                    return true;
                };
 
            }
        } else {
            alert("This browser does not support HTML5.");
            return false;
        }
    } else {
        alert("Please select a valid Image file.");
        return false;
    }
}
</script>