How to get Height and Width of an image using java script :client side validation
Validate Image height and width before uploading
----------------------------------------------------------------------------------
// HTML code
<!---
<BODY>
<input type="file" id="testImage" value="browse"/>
<input type="button" value="get Width" onclick="getWidth()"/>
<input type="button" value="get Height" onclick="getHeight()"/>
</BODY>
--->
------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------
/*
<script language="javascript">
function getWidth()
{
var testImage = document.getElementById('testImage');
alert(testImage.clientWidth);
}
function getHeight()
{
var testImage = document.getElementById('testImage');
alert(testImage.clientHeight);
}
</script>
function getWidth()
{
var testImage = document.getElementById('testImage');
alert(testImage.clientWidth);
}
function getHeight()
{
var testImage = document.getElementById('testImage');
alert(testImage.clientHeight);
}
</script>
*/
// HTML code
<!---
<BODY>
<input type="file" id="testImage" value="browse"/>
<input type="button" value="get Width" onclick="getWidth()"/>
<input type="button" value="get Height" onclick="getHeight()"/>
</BODY>
--->
------------------------------------------------------------------------------------------
Comments
Post a Comment