............................................... .................................................. .................................................. ..................
当选择图像宽!= 500像素时,为什么ie7不显示aleart消息?
............................................... .................................................. .................................................. ..................
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<input name="offer_image_1" type="file" id="offer_image_1" />
<script type="text/javascript">
var _URL = window.URL || window.webkitURL; // for check wide and height image
$("#offer_image_1").change(function(e) {
var offer_image_1, img;
if ((offer_image_1 = this.files[0])) {
img = new Image();
img.onload = function() {
if (this.width != '500')
{
alert("not width 500 px.");
}
};
img.src = _URL.createObjectURL(offer_image_1);
}
});
</script>
答案 0 :(得分:0)
试试这个,
if (this.width() != '500')
{
alert("not width 500 px.");
}