var curreny={ EUR:7.9, GBP:0, AUD:5.6, CAD:5.8, USD:6, toPrice:function(rmb,toMoney){ return Math.round(rmb/eval("this." + toMoney.toUpperCase())+0.5); } } $(function(){ $("span.rmbprice").css({color:'#C60',cursor:'pointer','border-bottom':'1px dashed #c60'}); $("span.rmbprice").hover( function(){ var ot=$(this).offset(); var l=ot.left-(150-$(this).width())/2; var t=ot.top-134; var fp=$("#floatPrice").html(); if(fp==null){ $("body").append('
'); }else{ $("#floatPrice").css({left:l,top:t}); $("#floatPrice").show(); } var rmb=$(this).attr("rmb"); if(rmb.length>0){ if(!isNaN(rmb)){ var html=''; html += ''; html += ''; html += ''; html += ''; html += ''; html += '
EUR  €' + curreny.toPrice(rmb,"EUR") + '
GBP  £' + curreny.toPrice(rmb,"GBP") + '
AUD  $' + curreny.toPrice(rmb,"AUD") + '
CAD  $' + curreny.toPrice(rmb,"CAD") + '
'; $("#priceContent").html(html); } } }, function(){ $("#floatPrice").hide(); } ); });