日期:2014-05-16 浏览次数:20462 次
function changed() { var former_currency=document.all("former_currency")[document.all("former_currency").selectedIndex].value; var object_currency=document.all('object_currency')[document.all('object_currency').selectedIndex].value; var original_value=document.getElementById("original_value").value; var object_value=document.getElementById("object_value").value; if (isNaN(original_value)) { alert("温馨提示:原价格只能为数字!\n请检查您的输入法是否是全角状态"); document.all("original_value").focus(); } else { var url="quote/exchangeCode.php?former_currency="+former_currency+"&object_currency="+object_currency+"&original_value="+original_value; CreateXMLHTTP(url,"object_value") } } function CreateXMLHTTP(url,DivId) { var xmlHttp = false; //判断浏览器 try { xmlHttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e2) { xmlHttp = false; } } if (!xmlHttp && typeof XMLHttpRequest != 'undefined') //判断是不是Firefox浏览等 { xmlHttp = new XMLHttpRequest(); if (xmlHttp.overrideMimeType) { xmlHttp.overrideMimeType('text/xml'); } } xmlHttp.onreadystatechange = function(){ if (xmlHttp.readyState==1 || xmlHttp.readyState==2 || xmlHttp.readyState==3 ) { document.getElementById(DivId).value="正在计算..."; } if (xmlHttp.readyState == 4) { if (xmlHttp.status==200 || xmlHttp.staus==0) { var result=parseFloat(xmlHttp.responseText); if (result<0) { result=" 网站名称 "; } document.getElementById(DivId).value = result; } } } xmlHttp.open("get",url,true); xmlHttp.setRequestHeader("Content-Type","text/html"); xmlHttp.setRequestHeader("Content-Type","charset=gb2312"); xmlHttp.send(null); }