HOW RICH ARE YOU? Use the codes below ,you can find where you sit in the richest people list in world.
It returns: About The Source: Sub 您有多富() Getit InputBox("请输入你的年收入(美元)", "提示", 6000) End Sub Sub Getit(ByVal myincome As Long) 'Input 'myincome = myincome * 0.145465 ' RMB to USD Dim i As Long, bindex As Long, sumx As Double, sumy As Double, sumxy As Double, sumx2 As Double Dim people, money, slope As Double, intb As Double, pos, percent, msg As String If myincome < 100 Then pos = 5780722892#: percent = 99.9: GoTo showmsg If myincome > 200000 Then pos = 107565: percent = 0.001: GoTo showmsg people = Array(0, 600000, 1200000, 3000000, 4500000, 5100000, 5395000, 5700000, 5940000, 5999990) money = Array(50, 400, 500, 850, 1486.67, 2182.35, 25000, 33700, 47500, 202000) bindex = WorksheetFunction.Match(myincome, money, 1) - 1 sumx = people(bindex) + people(bindex + 1) sumy = money(bindex) + money(bindex + 1) sumxy = people(bindex) * money(bindex) + people(bindex + 1) * money(bindex + 1) sumx2 = people(bindex) ^ 2 + people(bindex + 1) ^ 2 slope = (2 * sumxy - sumx * sumy) / (2 * sumx2 - sumx ^ 2) intb = (sumy - slope * sumx) / 2 pos = Round(6000000000# - ((myincome - intb) / slope) * 1000, 0) percent = Format((pos / 6000000000#) * 100, "0.00") showmsg: msg = "您目前年收入 " & myincome & " 美元!" & vbCrLf & vbCrLf msg = msg & "您在全球财富排行榜排名 " & pos & " 位!" & vbCrLf & vbCrLf msg = msg & "您属于全球 " & percent & "% 最富有的人!" & vbCrLf & vbCrLf msg = msg & Right(Space(200) & "阁下", 2 * Round(100 - percent, 0)) & vbCrLf & Right(Space(200) & "↓", 2 * Round(100 - percent, 0)) & vbCrLf msg = msg & String(100, "*") & vbCrLf msg = msg & "<--穷极-----------------------------------------全球人口 -------------------------------------富极-->" MsgBox msg, , "您有多富?" End Sub HOW RICH ARE YOU? |
![]() | Every year we gaze enviously at the lists of the richest people in world. Wondering what it would be like to have that sort of cash. But where would you sit on one of those lists? Here's your chance to find out. Just enter your annual income into the box below and hit 'show me the money' |
MY ANNUAL INCOME £ POUND$ US¥ YEN$ CAN€ EURO
The information above is from an instring web: http://www.globalrichlist.com/index.php
Codes of the webpage: http://globalrichlist.com/_js/project.js
/* *Author:SimonKallgard *RevisedbyMattiasGunneras2005-11-15 *RevisedbyMattiasGunneras2006-06-19 */ //declarevariables var ourpoor; var ourrich; var strInput; var strIncome; var strPlace2; var redman_startpos=21; var redman_lastpos=714; var redman_stepsize=7; var minDollarToCalc=100; var maxDollarToCalc=200000; //Detectbrowser ns4=(document.layers)? true : false ns6=(document.getElementById)? true : false ie4=(document.all)? true : false //theos var agt=navigator.userAgent.toLowerCase(); var iswin=(agt.indexOf( "win" )!=-1); var ismac=(agt.indexOf( "mac" )!=-1); var isopera=(agt.indexOf( "opera" )!=-1); //setupforcalculationsfurtherdown. totalPopulation=6000000000; avarageYearlyIncome=5000; totalWorldwideYearlyIncome=totalPopulation*avarageYearlyIncome; //Setuprelationshipbetweenmoneyandpopulation peopleBlock= new Array(0,600000,1200000,3000000,4500000,5100000,5395000,5700000,5940000,5999990); //(Xaxel) moneyBlock= new Array(50,400,500,850,1486.67,2182.35,25000,33700,47500,202000); //(Yaxel) //returnsarraywith //[0]=SLOPE,m //[1]=y-int,b //[2]=R function calcTrendRSquare(arrX,arrY){ var n=arrX.length; var sumX=0; var sumY=0; var sumXY=0; var sumX2=0; var sumY2=0; for ( var i=0;i<arrX.length;i++){ sumX+=arrX[i]; sumY+=arrY[i]; sumXY+=arrX[i]*arrY[i]; sumX2+=Math.pow(arrX[i],2); sumY2+=Math.pow(arrY[i],2); } var sumX2_2=Math.pow(sumX,2); var sumY2_2=Math.pow(sumY,2); var slope_m=(n*sumXY-sumX*sumY)/(n*sumX2-sumX2_2); var yInt_b=(sumY-slope_m*sumX)/n; var r=(n*sumXY-sumX*sumY)/Math.sqrt((n*sumX2-sumX2_2)*(n*sumY2-sumY2_2)); var returnArray= new Array(slope_m,yInt_b,r); return returnArray; } function getPeoplePoorer(bIndex,income){ //gettheR-squareTrend var people= new Array(peopleBlock[bIndex],peopleBlock[bIndex+1]); var money= new Array(moneyBlock[bIndex],moneyBlock[bIndex+1]); var rSquare=calcTrendRSquare(people,money); var peoplePoorer=((income+(rSquare[1]*-1))/rSquare[0])*1000; return peoplePoorer; //peoplePoorer=(((strInput*1)-253.95)/0.0002)*1000 } arrDidYouKnow= new Array(); arrDidYouKnow[0]= "Theworld's225richestpeoplenowhaveacombinedwealthof$1trillion." "That'sequaltothecombinedannualincomeoftheworld's2.5billionpoorestpeople" ; arrDidYouKnow[1]= "Threebillionpeopleliveonlessthan$2perdaywhile1.3billiongetbyonlessthan" "$1perday.Seventypercentofthoselivingonlessthan$1perdayarewomen." ; arrDidYouKnow[2]= "Threedecadesago,thepeopleinwell-to-docountrieswere30timesbetteroffthan" "thoseincountrieswherethepoorest20percentoftheworld'speoplelive.By1998,thisgaphad" "widenedto82times." ; arrDidYouKnow[3]= "MicrosoftCEOBillGateshasmorewealththanthebottom45percentofAmerican" "householdscombined." ; //openpopupwindow function open_window(qs){ //thewidthandheight width=400; height=300; //getthetopleftcornerforthepopup sx=screen.width/2-width/2; sy=screen.height/2-height/2; //openthepopupwindow window.open( 'download.php?' +escape(qs), '' , 'width=' +width+ ',height=' +height+',resizable=no,toolbar=0, location=0,directories=0,status=0,menubar=0,scrollbars=auto,screenX= '+sx+' ,screenY= '+sy+' ,top= '+sy+' ,left='+sx); } //ifsubmitted function fnSubmit(){ //errorcheck if (document.priceForm.strIn.value== "" ){ new Effect.Shake( 'infield' ); layerWrite( 'error' , null , 'Pleasetypeinyourincome.' ); return false ; } else { layerWrite( 'error' , null , '' ); } ourpoor= false ; ourrich= false ; //array arrPlace= new Array(); strPlace2= "" ; arrPlaceRicher= new Array(); strPlaceRicher2= "" ; //theinput strInput=document.priceForm.strIn.value; currency=document.priceForm.currency.value; //removedots strInput=strInput.replace( "." , "" ); strInput=strInput.replace( "," , "" ); strInput=strInput.replace( "" , "" ); strIncome=strInput.toString(); strHourly=(Math.floor((strInput/1440)*100)/100); //convertcurrencysowecancalculatewithusdollars. //currancyratesupdatedJune20th2006.source:http://www.di.se if (currency== "uk" ){ strInput=strInput*1.8412; strCurrency= "┬г" ; } else if (currency== "can" ){ strInput=strInput*0.8961; strCurrency= "$" ; } else if (currency== "euro" ){ strInput=strInput*1.257; strCurrency= "€" ; } else if (currency== "jpn" ){ strInput=strInput*0.008698; strCurrency= "¥" ; } else if (currency== "us" ){ strCurrency= "$" ; } //validateinput if (isNaN(strInput)){ //notvalid new Effect.Shake( 'infield' ); layerWrite( 'error' , null , 'Pleasetypeinyourincome.' ); } else { layerWrite( 'error' , null , '' ); /* *strPlaceisactuallyhowmanypeoplethatarepoorerthanyou. *calculateplaceandpercent */ //gettheindextoplaywith var blockIndex=0; for ( var i=0;i<moneyBlock.length;i++){ if (strInput<moneyBlock[i]){ blockIndex=i-1; break ; } } strPlace=getPeoplePoorer(blockIndex,(strInput*1)); //converttostring strPlace=strPlace.toString(); //gettherightdigits strPlace=strPlace.substring(0,10); //makenumberagain strPlace=(strPlace*1); strPlace_1=strPlace; strPlace=6000000000-strPlace; //calculatepercentage strPercentagePoorer=(strPlace/6000000000)*100; strPercentagePoorer=Math.floor(strPercentagePoorer*100)/100; //peoplericher strPlaceRicher=strPlace; //peoplepoorer strPlace=strPlace_1; //converttostringagain strPlace=strPlace.toString(); strPlaceRicher=strPlaceRicher.toString(); strIncome=strIncome.toString(); //forthepopupwindow tempPlace=strPlaceRicher; strPlace2=addSpaces(strPlace); strPlaceRicher2=addSpaces(strPlaceRicher); if (strInput<=minDollarToCalc){ //nooutputiflessthan$100/day ourpoor= true ; strPercentagePoorer=1; } else if (strInput>maxDollarToCalc){ //nooutputifmorethan200000dollars/day ourrich= true ; strPercentagePoorer=99; } //calchoursalary var hourSalary=strInput/1872; //settextforthecopybox var copybox= "<spanclass='blackheader'>RICHERTHANYOUTHINK?</span><br/><br/>" ; copybox+= "Howdoyoufeelaboutthat?Abitricherwehope.Richerandreadytogivesomeof" "yournewlyfoundwealthtothosewhoneeditmost.Itnothard-justslipyourhandinyourpocketand" "pulloutsomethingspecial.Somethingthatcanhelpredressthebalance-andalsomakeyoufeel" "uncommonlygood.Manypeopleslivescouldbehappierifyoudonatedjust" ; copybox+= "<strong>onehour'ssalary</strong>(approx<strong><spanclass='red'>$" + addDecimals(hourSalary,2)+ "</span></strong>-UKestimate).<br/><br/>" ; copybox+= "Allyouhavetodoismakeachoice.<br/><br/>" ; copybox+= "<strong><spanclass='red'>$8</span></strong>couldbuyyou15organicapples" "OR25fruittreesforfarmersinHondurastogrowandsellfruitattheirlocalmarket.<br/><br/>" ; copybox+= "<strong><spanclass='red'>$30</span></strong>couldbuyyouanERDVDBoxset" "ORaFirstAidkitforavillageinHaiti.<br/><br/>" ; copybox+= "<strong><spanclass='red'>$73</span></strong>couldbuyyouanewmobile" "phoneORanewmobilehealthclinictocareforAIDSorphansinUganda.<br/><br/>" ; copybox+= "<strong><spanclass='red'>$2400</span></strong>couldbuyyouasecond" "generationHighDefinitionTVORschoolingforanentiregenerationofschoolchildreninanAngolan" "village.<br/><br/>" ; if (ourpoor== true ){ //ifyouarepoor //changecopyboxcopyifpoor var copybox= "<br><br>" ; copybox+= "" ; copybox+= "<strong>Poorcountrieslosearound£1.3billioneverydayasadirect" "resultoftradepoliciesthatputprofitsbeforepeople.</strong><br><br>" ; copybox+= "Peoplewhoselivescouldbedramaticallyimprovedorevensavedifglobal" "traderulesweremadefairer.<br><br>" ; copybox+= "<strong>Byworkingtogether-throughMakePovertyHistorywecanhelp" "makethedifferencebetweenpovertyandprosperityformillionsofpeople.</strong><br><br>" ; copybox+= "Thisisacrucialtimetocampaignfortradejustice.TheWorldTrade" "Organisation-oneofthemainorganisationsgoverninginternationaltrade-holdsitsbiennial" "summiton13-18December2005,inHongKong.<br><br>" ; strPlaceRicher2= "5,780,722,892" ; strPercentagePoorer= "99.9" ; tempPlace= "5780722892" ; strPlace2= "5,780,722,892" ; currpos=redman_startpos; } else if (ourrich== true ){ //ifyouareveryrich strPlaceRicher2= "107,565" ; strPercentagePoorer= "0.001" ; tempPlace= "107565" ; strPlace2= "107,565" ; currpos=redman_lastpos; } else if (ourpoor== false &&ourrich== false ){ //ifyouarewithintheacceptablerange //getthestepnumber var stepNbr=Math.round(((100-strPercentagePoorer)*0.01)*100); //getthepixelposforarrowredman currpos=Math.round(stepNbr*redman_stepsize)+redman_startpos; } //setDIDYOUKNOW?text var didyou=arrDidYouKnow[Math.round(Math.random()*3)]; var downloadlink= "<ahref='download.php?" +tempPlace+ "'onFocus='blur();'>Clickhere" "</a>todownloadthecodeyou'llneed" ; var tmpIncome=addSpaces(strIncome); //removecommaiflessthen999. if (strIncome<=999){ tmpIncome=tmpIncome.replace( "," , "" ); } //sethtmlforboxes var nbrRichest1= "=" +strPlaceRicher2; var nbrRichest2=strPlaceRicher2; var nbrPercent= "TOP" +strPercentagePoorer+ "%" ; //dontprintinfoboxestopageifpoor if (!ourpoor){ layerWrite( 'nbrRichest1' , null ,nbrRichest1); layerWrite( 'nbrRichest2' , null ,nbrRichest2); layerWrite( 'nbrPercent' , null ,nbrPercent); } //mainboxwithlotsofcopy layerWrite( 'copybox' , null ,copybox); //Didyouknow layerWrite( 'didyou' , null ,didyou); //linktodownloadpage. layerWrite( 'downloadlink' , null ,downloadlink); //thelittleboxdownonpage. layerWrite( 'helpboxrichest' , null ,strPlaceRicher2); //movetorightplaceonline //andshowstheresultblock fn_move_pos(currpos); } } //reversesastringoftext function reverse(value){ for ( var text= '' ,i=value.length-1;i>-1;i=i-1){ text+=value.charAt(i); } return text; } function addDecimals(value,nbrOfDecimals){ value=value.toString(); var dotIndex=value.lastIndexOf( '.' ); if (dotIndex<0){ var decimal= "" ; for (i=0;i<nbrOfDecimals;i++) decimal+= "0" ; } else { return value.substring(0,dotIndex+nbrOfDecimals+1); } } //displayanswer function layerWrite(id,nestref,text){ if (ns4){ var lyr=(nestref)? eval( 'document.' +nestref+ '.document.' +id+ '.document' ):document.layers[id].document lyr.open() lyr.write(text) lyr.close() } if (ie4){ document.all[id].innerHTML=text; } //NS6 if (ns6){ document.getElementById(id).innerHTML=text; } } function addSpaces(str){ //reversethestring str=reverse(str); //makearray for (i=0;i<str.length;i++){ arrPlace[i]=str.charAt(i); } var str2= "" ; //addspaces for (i=0;i<str.length;i++){ if ((i==2)||(i==5&&(str.length!=6))||(i==8&&(str.length!=9))){ str2=str2+arrPlace[i]+ "," } else { str2=str2+arrPlace[i]; } } //reverseitbackagainandreturn. str=reverse(str2); return str; } //includesthenews function fnInclude(){ if (ie4){ document.all.news.style.visibility= 'visible' ; if (iswin){ document.all.news.style.top=795; } else { document.all.news.style.top=775; } } else if (ns4){ document.news.visibility= 'show' ; document.news.top=795; } else if (ns6){ document.getElementById( 'news' ).style.visibility= 'visible' ; document.getElementById( 'news' ).style.top=795; } } //hidesthenews function fnIncludeHide(){ if (ie4){ document.all.news.style.visibility= 'hidden' ; if (iswin){ document.all.news.style.top=795; } else { document.all.news.style.top=775; } } else if (ns4){ document.news.visibility= 'hide' ; document.news.top=795; } else if (ns6){ document.getElementById( 'news' ).style.visibility= 'hidden' ; document.getElementById( 'news' ).style.top=795; } } //movesthepositiongraphicANDshowstheresultblock function fn_move_pos(topos){ var nowpos=0; if (ie4){ nowpos=document.all.redman.style.left; document.all.resultblock.style.display= 'block' ; document.all.resultblock.style.visibility= 'visible' ; } else if (ns4){ nowpos=document.redman.left; document.resultblock.visibility= 'show' ; document.resultblock.display= 'block' ; } else if (ns6){ nowpos=document.getElementById( 'redman' ).style.left; document.getElementById( 'resultblock' ).style.display= 'block' ; document.getElementById( 'resultblock' ).style.visibility= 'visible' ; } if (!nowpos){ nowpos=redman_startpos; } else { nowpos=nowpos.substring(0,nowpos.indexOf( 'p' )); } if (ie4&&ismac&&!isopera){ document.all.redman.style.left=topos; } else { endpos=topos-nowpos; new Effect.ScrollTo( 'resultblock' ,{duration:1.0}); new Effect.MoveBy( 'redman' ,0,endpos,{duration:1.3,queue: 'end' }); } return false ; } function hide_pos(){ if (ie4){ document.all.arr.style.visibility= 'hidden' ; document.all.line.style.visibility= 'hidden' ; } else if (ns4){ document.arr.visibility= 'hide' ; document.line.visibility= 'hide' ; } else if (ns6){ document.getElementById( 'arr' ).style.visibility= 'hidden' ; document.getElementById( 'line' ).style.visibility= 'hidden' ; } } function whatkey(){ if (ie4||ns6){ thekey=window.event.keyCode; if (thekey==13&&iswin){ fnSubmit(); } } }
|