ï»?/ JScript æ–‡ä»¶

//å›¾ç‰‡å¯¹è±¡,ä¸€èˆ¬ç”¨this
//maxWidthè®¾ç½®å›¾ç‰‡å®½åº¦ç•Œé™
//maxHeightè®¾ç½®å›¾ç‰‡é«˜åº¦ç•Œé™
function SetImgAutoSize(myimg,mywidth,myheight)
{
    var tmp_img = new Image();
tmp_img.src=myimg.src;
image_x=tmp_img.width;
image_y=tmp_img.height;
	if(image_x > mywidth){
	tmp_img.height=image_y * mywidth / image_x;
	tmp_img.width=mywidth;
		if(tmp_img.height>myheight){
			tmp_img.width=tmp_img.width * myheight / tmp_img.height;
			tmp_img.height=myheight;
			}
	}else if(image_y > myheight)
	{
	tmp_img.width=image_x * myheight / image_y;
	tmp_img.height=myheight;
		if(tmp_img.width>mywidth){
			tmp_img.height=tmp_img.height * mywidth / tmp_img.width;
			tmp_img.width=mywidth;
			}
	}
	myimg.width=tmp_img.width;
	myimg.height=tmp_img.height;
}

function Search()
{
    var url='product.html';
    var keywords = document.getElementById('skey').value;
    var cid = document.getElementById('category').value;
    if(keywords=='' || keywords=='â†?Please enter the keyword')
    {
        alert('please input keywords!');
        return;
    }    
    if(keywords!='') url+='?keywords=' + keywords;
    if(cid!='') url+='&cid=' + cid;
    location.href = url;
}
function Inquir()
{
    var url='contactnow.html?tosubject=';
    var r='';
    r= getValue();
    if(r=='')
    {
       alert('No item(s) selected.');
       return;    
    }
    else
    {
      url+=r;    
    }
    location.href = url;
}


function   getValue()   
 { 
 ã€€var r='';
 ã€€var   inputs   =   document.all.tags("input");   
   for( var i=0;i<inputs.length;i++)   //   éåŽ†é¡µé¢ä¸Šæ‰€æœ‰çš„   input     
ã€€ {   
ã€€ã€€ã€€ã€€if   (inputs[i].type   ==   "checkbox"   )   
ã€€ã€€ã€€ã€€{   
ã€€ã€€ã€€ã€€ã€€ã€€if(inputs[i].checked)   
ã€€ã€€ã€€ã€€ã€€ã€€r+=inputs[i].value+" | "

ã€€ã€€ã€€ã€€}             
 ã€€}   
   return r;       ã€€ã€€ã€€ã€€ã€€ã€€ã€€   
    ã€€ã€€ã€€ã€€ã€€ã€€   
 }   
 
 

 


