KidsLovePC Contact Us
  Home   PHP  Graphics ASP  JavaScript   J2EE  HTML  JAVA   Swing   Webtip  Forums  Lyric  Free sheet music  Ringtones

Best books about Javasript

java script,javascript, javascript detect chinese input formDetect image size using Javascript

If you host image gallery business, sometimes you need limit the uploading image size. You may use the following javascript to check the image size.

First you may take a look at the following demo.

 

javascript java script flash check detectHow to do it.

Copy the following code to your web page <head></head> section.

<SCRIPT LANGUAGE="JavaScript">
<!--
function imgExceedSize(w,h){
if(!document.form1.image.value==""){
if(img.width>w || img.height>h){
alert("Image size:"+img.width+"X"+img.height+"。Image too big!Please make it less than "+w+"×"+h);
return true;
}else{
return false;
}
}else{
return true;
}
}

function detect(){
var ok=imgExceedSize(20,20); //20,20 are size limitation
if(ok){
document.form1.reset();
}else{

//success uploading image
document.form1.submit();
}
}

//-->
</SCRIPT>

You set imgExceedSize(width,height); to your desired image size.

 

 

Best books about ASP & ASP.Net from Amazon
JavaScript Bible, Fifth Edition (Paperback) JavaScript & DHTML Cookbook (Paperback) JavaScript: The Definitive Guide (Paperback) Beginning JavaScript Second Edition (Paperback) JavaScript: The Complete Reference, Second Edition (Paperback)

 

Printer Inkjet A Z lyricsLearn ChineseHome|PHP|Swing|HTML|JavaScript|ASP|JAVA|Forum|WebTip|Contact Us
Copyright © kidslovepc.com All rights reserved(new). Privacy|Copyright
designed by info@kidslovepc.com

Please help us cover the web site maintenance fee.
barcode scanner Thermal Printer credit card machine bar code printer