ͼƬÉÏ´«javascript¿Í»§¶ËÑéÖ¤!
JScript code:
if(flag){
var img= new Image();
if(names[0].value!=""){
img.src=names[0].value;
alert(img.width);//µ¯³öͼƬ¿í¶È
if(img.width>990||img.width<850){
alert("ÉÏ´«Í¼Æ¬¿í±ØÐëΪ850pxµ½990pxÖ®¼ä!");
return false;
}else if(img.height<300||img.height>350) {
alert("ÉÏ´«Í¼Æ¬¸ß±ØÐëΪ300pxµ½350pxÖ®¼ä!");
return false;
}else {
return true;
}
}
return false;
}else{
alert('ÇëÑ¡ÔñÄãÒªÉÏ´«µÄÏàÆ¬!');
}
alert(img.width);//µ¯³öͼƬ¿í¶ÈʼÖÕΪ0!
ÕâÊÇʲôÔÒò?,ÔõÑù²ÅÄÜ»ñµÃͼƬ´óС!
ɳ·¢Ñ½!
imgÐè¼ÓÔØÏÔʾ³öÀ´,²ÅÓдóС.
Äã¿ÉÒÔ¼ÓÒ»¸öÔ¤ÀÀµÄͼƬ£¬¼ÓÔØºó»ñµÃ´óС¡£
<script language="javascript">
var ImgObj= new Image();
var FileObj;
function checkImg(){
var imgSrc = document.frm1.img1.value;
//alert(imgSrc);
ImgObj.src=imgSrc;
CheckProperty(ImgObj);
}
function CheckProperty(obj) //¼ì²âͼÏñÊôÐÔ
{
Ïà¹ØÎÊ´ð£º
ÎÒµÄÍøÒ³ÉÏ·ÅÖÃÁËÒ»¸öActiveX¿Ø¼þ£¬¿Ø¼þÃûΪNVSViewerCtrlEx£¬clsid:9D78E092-86F1-487E-91DA-6D7D44ED985A£¬¿Ø¼þʼþ֪ͨ£¨µ±Êó±êÑ¡Öд°¿Úʱ´¥·¢£¬OnSelectedView(long lView)£¬ÆäÖÐlView£º´Ó0¿ªÊ¼µÄÐòÊý£©;Õâ¸ö¿Ø¼ ......
ÓÃjavascript½«Êý¾Ýµ¼³öµ½Îı¾Îļþ(txt)ÖÐ..
Ê×ÏȼÙÉèÒѾÓÐÁËÐèҪдÈëµÄÎı¾ÄÚÈÝ var txtContent ="ÐèҪдÈëµÄÄÚÈÝ";
ÏÖÔÚÐèÒªÓÃjavascript½«ÄÚÈÝдÈëtxtÎļþ(Õâ¸ötxtÎļþ²»´æÔÚ,ÐèÒª´´½¨)ÖÐ,È»ºóдºÃÖ ......
<html>
<head>
<title></title>
</head>
<body>
<font color="#0000FF"><b>ÇëÔÚÎı¾¿ò1ÖÐÊäÈëÎÄ×Ö£º</b>
<form>
<input ......
ÎÒÒ²À´Ò»¸öȤζjavascript:
´ò¿ªÒÔÏÂhtmlÎļþ,ÒÀ´Î°´ÏÂG,L,CÈý¸ö¼ü,¾Í»áÓÐÆæ¼£³öÏÖ!!
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" ......