How Rich Are You in the World?

HOW RICH ARE YOU?

Use the codes below ,you can find where you sit in the richest people list in world.

  1. Sub Showhowrichyouare()
  2. GetitInputBox( "Pleaseenteryourannualincome(USD)" , "info" ,6000)
  3. End Sub
  4. Sub Getit( ByVal myincome As Long ) 'Input
  5. 'myincome=myincome*0.145465'RMBtoUSD
  6. Dim i As Long ,bindex As Long ,sumx As Double ,sumy As Double ,sumxy As Double ,sumx2 As Double
  7. Dim people,money,slope As Double ,intb As Double ,pos,percent,msg As String
  8. If myincome<100 Then pos=5780722892#:percent=99.9: GoTo showmsg
  9. If myincome>200000 Then pos=107565:percent=0.001: GoTo showmsg
  10. people=Array(0,600000,1200000,3000000,4500000,5100000,5395000,5700000,5940000,5999990)
  11. money=Array(50,400,500,850,1486.67,2182.35,25000,33700,47500,202000)
  12. For i=0 To 9
  13. If myincome<money(i) Then bindex=i-1: Exit For
  14. Next
  15. sumx=people(bindex)+people(bindex+1)
  16. sumy=money(bindex)+money(bindex+1)
  17. sumxy=people(bindex)*money(bindex)+people(bindex+1)*money(bindex+1)
  18. sumx2=people(bindex)^2+people(bindex+1)^2
  19. slope=(2*sumxy-sumx*sumy)/(2*sumx2-sumx^2)
  20. intb=(sumy-slope*sumx)/2
  21. pos=Round(6000000000#-((myincome-intb)/slope)*1000,0)
  22. percent=Format((pos/6000000000#)*100, "0.00" )
  23. showmsg:
  24. msg= "Yourannualincomeis$" &myincome& "now" &vbCrLf&vbCrLf
  25. msg=msg& "Youarethe" &pos& "richestpersonintheworld!" &vbCrLf&vbCrLf
  26. msg=msg& "You'reintheTOP" &percent& "%richestpeopleintheworld!" &vbCrLf&vbCrLf&vbCrLf
  27. msg=msg&Right(Space(200)& "YOU" ,2*Round(100-percent,0))&vbCrLf&Right(Space(200)& "↓" ,2*Round(100-percent,0))&vbCrLf
  28. msg=msg& String (100, "*" )&vbCrLf
  29. msg=msg& "<--POOREST------------------------------------THEWHOLEPOPULATIONOFTHEWORLD!--------------------------------RICHEST-->"
  30. MsgBoxmsg,, "HowRichareyou?"
  31. End Sub

It returns:

How Rich Are You in the World?

About The Source:

HOW RICH ARE YOU?

<!-- TOP COPY -->


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
  1. /*
  2. *Author:SimonKallgard
  3. *RevisedbyMattiasGunneras2005-11-15
  4. *RevisedbyMattiasGunneras2006-06-19
  5. */
  6. //declarevariables
  7. var ourpoor;
  8. var ourrich;
  9. var strInput;
  10. var strIncome;
  11. var strPlace2;
  12. var redman_startpos=21;
  13. var redman_lastpos=714;
  14. var redman_stepsize=7;
  15. var minDollarToCalc=100;
  16. var maxDollarToCalc=200000;
  17. //Detectbrowser
  18. ns4=(document.layers)? true : false
  19. ns6=(document.getElementById)? true : false
  20. ie4=(document.all)? true : false
  21. //theos
  22. var agt=navigator.userAgent.toLowerCase();
  23. var iswin=(agt.indexOf( "win" )!=-1);
  24. var ismac=(agt.indexOf( "mac" )!=-1);
  25. var isopera=(agt.indexOf( "opera" )!=-1);
  26. //setupforcalculationsfurtherdown.
  27. totalPopulation=6000000000;
  28. avarageYearlyIncome=5000;
  29. totalWorldwideYearlyIncome=totalPopulation*avarageYearlyIncome;
  30. //Setuprelationshipbetweenmoneyandpopulation
  31. peopleBlock= new Array(0,600000,1200000,3000000,4500000,5100000,5395000,5700000,5940000,5999990); //(Xaxel)
  32. moneyBlock= new Array(50,400,500,850,1486.67,2182.35,25000,33700,47500,202000); //(Yaxel)
  33. //returnsarraywith
  34. //[0]=SLOPE,m
  35. //[1]=y-int,b
  36. //[2]=R
  37. function calcTrendRSquare(arrX,arrY){
  38. var n=arrX.length;
  39. var sumX=0;
  40. var sumY=0;
  41. var sumXY=0;
  42. var sumX2=0;
  43. var sumY2=0;
  44. for ( var i=0;i<arrX.length;i++){
  45. sumX+=arrX[i];
  46. sumY+=arrY[i];
  47. sumXY+=arrX[i]*arrY[i];
  48. sumX2+=Math.pow(arrX[i],2);
  49. sumY2+=Math.pow(arrY[i],2);
  50. }
  51. var sumX2_2=Math.pow(sumX,2);
  52. var sumY2_2=Math.pow(sumY,2);
  53. var slope_m=(n*sumXY-sumX*sumY)/(n*sumX2-sumX2_2);
  54. var yInt_b=(sumY-slope_m*sumX)/n;
  55. var r=(n*sumXY-sumX*sumY)/Math.sqrt((n*sumX2-sumX2_2)*(n*sumY2-sumY2_2));
  56. var returnArray= new Array(slope_m,yInt_b,r);
  57. return returnArray;
  58. }
  59. function getPeoplePoorer(bIndex,income){
  60. //gettheR-squareTrend
  61. var people= new Array(peopleBlock[bIndex],peopleBlock[bIndex+1]);
  62. var money= new Array(moneyBlock[bIndex],moneyBlock[bIndex+1]);
  63. var rSquare=calcTrendRSquare(people,money);
  64. var peoplePoorer=((income+(rSquare[1]*-1))/rSquare[0])*1000;
  65. return peoplePoorer;
  66. //peoplePoorer=(((strInput*1)-253.95)/0.0002)*1000
  67. }
  68. arrDidYouKnow= new Array();
  69. arrDidYouKnow[0]= "Theworld's225richestpeoplenowhaveacombinedwealthof$1trillion."
  70. "That'sequaltothecombinedannualincomeoftheworld's2.5billionpoorestpeople" ;
  71. arrDidYouKnow[1]= "Threebillionpeopleliveonlessthan$2perdaywhile1.3billiongetbyonlessthan"
  72. "$1perday.Seventypercentofthoselivingonlessthan$1perdayarewomen." ;
  73. arrDidYouKnow[2]= "Threedecadesago,thepeopleinwell-to-docountrieswere30timesbetteroffthan"
  74. "thoseincountrieswherethepoorest20percentoftheworld'speoplelive.By1998,thisgaphad"
  75. "widenedto82times." ;
  76. arrDidYouKnow[3]= "MicrosoftCEOBillGateshasmorewealththanthebottom45percentofAmerican"
  77. "householdscombined." ;
  78. //openpopupwindow
  79. function open_window(qs){
  80. //thewidthandheight
  81. width=400;
  82. height=300;
  83. //getthetopleftcornerforthepopup
  84. sx=screen.width/2-width/2;
  85. sy=screen.height/2-height/2;
  86. //openthepopupwindow
  87. window.open( 'download.php?' +escape(qs), '' , 'width=' +width+ ',height=' +height+',resizable=no,toolbar=0,
  88. location=0,directories=0,status=0,menubar=0,scrollbars=auto,screenX= '+sx+' ,screenY= '+sy+' ,top= '+sy+' ,left='+sx);
  89. }
  90. //ifsubmitted
  91. function fnSubmit(){
  92. //errorcheck
  93. if (document.priceForm.strIn.value== "" ){
  94. new Effect.Shake( 'infield' );
  95. layerWrite( 'error' , null , 'Pleasetypeinyourincome.' );
  96. return false ;
  97. } else {
  98. layerWrite( 'error' , null , '' );
  99. }
  100. ourpoor= false ;
  101. ourrich= false ;
  102. //array
  103. arrPlace= new Array();
  104. strPlace2= "" ;
  105. arrPlaceRicher= new Array();
  106. strPlaceRicher2= "" ;
  107. //theinput
  108. strInput=document.priceForm.strIn.value;
  109. currency=document.priceForm.currency.value;
  110. //removedots
  111. strInput=strInput.replace( "." , "" );
  112. strInput=strInput.replace( "," , "" );
  113. strInput=strInput.replace( "" , "" );
  114. strIncome=strInput.toString();
  115. strHourly=(Math.floor((strInput/1440)*100)/100);
  116. //convertcurrencysowecancalculatewithusdollars.
  117. //currancyratesupdatedJune20th2006.source:http://www.di.se
  118. if (currency== "uk" ){
  119. strInput=strInput*1.8412;
  120. strCurrency= "┬г" ;
  121. } else if (currency== "can" ){
  122. strInput=strInput*0.8961;
  123. strCurrency= "$" ;
  124. } else if (currency== "euro" ){
  125. strInput=strInput*1.257;
  126. strCurrency= "€" ;
  127. } else if (currency== "jpn" ){
  128. strInput=strInput*0.008698;
  129. strCurrency= "¥" ;
  130. } else if (currency== "us" ){
  131. strCurrency= "$" ;
  132. }
  133. //validateinput
  134. if (isNaN(strInput)){
  135. //notvalid
  136. new Effect.Shake( 'infield' );
  137. layerWrite( 'error' , null , 'Pleasetypeinyourincome.' );
  138. } else {
  139. layerWrite( 'error' , null , '' );
  140. /*
  141. *strPlaceisactuallyhowmanypeoplethatarepoorerthanyou.
  142. *calculateplaceandpercent
  143. */
  144. //gettheindextoplaywith
  145. var blockIndex=0;
  146. for ( var i=0;i<moneyBlock.length;i++){
  147. if (strInput<moneyBlock[i]){
  148. blockIndex=i-1;
  149. break ;
  150. }
  151. }
  152. strPlace=getPeoplePoorer(blockIndex,(strInput*1));
  153. //converttostring
  154. strPlace=strPlace.toString();
  155. //gettherightdigits
  156. strPlace=strPlace.substring(0,10);
  157. //makenumberagain
  158. strPlace=(strPlace*1);
  159. strPlace_1=strPlace;
  160. strPlace=6000000000-strPlace;
  161. //calculatepercentage
  162. strPercentagePoorer=(strPlace/6000000000)*100;
  163. strPercentagePoorer=Math.floor(strPercentagePoorer*100)/100;
  164. //peoplericher
  165. strPlaceRicher=strPlace;
  166. //peoplepoorer
  167. strPlace=strPlace_1;
  168. //converttostringagain
  169. strPlace=strPlace.toString();
  170. strPlaceRicher=strPlaceRicher.toString();
  171. strIncome=strIncome.toString();
  172. //forthepopupwindow
  173. tempPlace=strPlaceRicher;
  174. strPlace2=addSpaces(strPlace);
  175. strPlaceRicher2=addSpaces(strPlaceRicher);
  176. if (strInput<=minDollarToCalc){ //nooutputiflessthan$100/day
  177. ourpoor= true ;
  178. strPercentagePoorer=1;
  179. } else if (strInput>maxDollarToCalc){ //nooutputifmorethan200000dollars/day
  180. ourrich= true ;
  181. strPercentagePoorer=99;
  182. }
  183. //calchoursalary
  184. var hourSalary=strInput/1872;
  185. //settextforthecopybox
  186. var copybox= "<spanclass='blackheader'>RICHERTHANYOUTHINK?</span><br/><br/>" ;
  187. copybox+= "Howdoyoufeelaboutthat?Abitricherwehope.Richerandreadytogivesomeof"
  188. "yournewlyfoundwealthtothosewhoneeditmost.Itnothard-justslipyourhandinyourpocketand"
  189. "pulloutsomethingspecial.Somethingthatcanhelpredressthebalance-andalsomakeyoufeel"
  190. "uncommonlygood.Manypeopleslivescouldbehappierifyoudonatedjust" ;
  191. copybox+= "<strong>onehour'ssalary</strong>(approx<strong><spanclass='red'>$" +
  192. addDecimals(hourSalary,2)+ "</span></strong>-UKestimate).<br/><br/>" ;
  193. copybox+= "Allyouhavetodoismakeachoice.<br/><br/>" ;
  194. copybox+= "<strong><spanclass='red'>$8</span></strong>couldbuyyou15organicapples"
  195. "OR25fruittreesforfarmersinHondurastogrowandsellfruitattheirlocalmarket.<br/><br/>" ;
  196. copybox+= "<strong><spanclass='red'>$30</span></strong>couldbuyyouanERDVDBoxset"
  197. "ORaFirstAidkitforavillageinHaiti.<br/><br/>" ;
  198. copybox+= "<strong><spanclass='red'>$73</span></strong>couldbuyyouanewmobile"
  199. "phoneORanewmobilehealthclinictocareforAIDSorphansinUganda.<br/><br/>" ;
  200. copybox+= "<strong><spanclass='red'>$2400</span></strong>couldbuyyouasecond"
  201. "generationHighDefinitionTVORschoolingforanentiregenerationofschoolchildreninanAngolan"
  202. "village.<br/><br/>" ;
  203. if (ourpoor== true ){
  204. //ifyouarepoor
  205. //changecopyboxcopyifpoor
  206. var copybox= "<br><br>" ;
  207. copybox+= "" ;
  208. copybox+= "<strong>Poorcountrieslosearound£1.3billioneverydayasadirect"
  209. "resultoftradepoliciesthatputprofitsbeforepeople.</strong><br><br>" ;
  210. copybox+= "Peoplewhoselivescouldbedramaticallyimprovedorevensavedifglobal"
  211. "traderulesweremadefairer.<br><br>" ;
  212. copybox+= "<strong>Byworkingtogether-throughMakePovertyHistorywecanhelp"
  213. "makethedifferencebetweenpovertyandprosperityformillionsofpeople.</strong><br><br>" ;
  214. copybox+= "Thisisacrucialtimetocampaignfortradejustice.TheWorldTrade"
  215. "Organisation-oneofthemainorganisationsgoverninginternationaltrade-holdsitsbiennial"
  216. "summiton13-18December2005,inHongKong.<br><br>" ;
  217. strPlaceRicher2= "5,780,722,892" ;
  218. strPercentagePoorer= "99.9" ;
  219. tempPlace= "5780722892" ;
  220. strPlace2= "5,780,722,892" ;
  221. currpos=redman_startpos;
  222. } else if (ourrich== true ){
  223. //ifyouareveryrich
  224. strPlaceRicher2= "107,565" ;
  225. strPercentagePoorer= "0.001" ;
  226. tempPlace= "107565" ;
  227. strPlace2= "107,565" ;
  228. currpos=redman_lastpos;
  229. } else if (ourpoor== false &&ourrich== false ){
  230. //ifyouarewithintheacceptablerange
  231. //getthestepnumber
  232. var stepNbr=Math.round(((100-strPercentagePoorer)*0.01)*100);
  233. //getthepixelposforarrowredman
  234. currpos=Math.round(stepNbr*redman_stepsize)+redman_startpos;
  235. }
  236. //setDIDYOUKNOW?text
  237. var didyou=arrDidYouKnow[Math.round(Math.random()*3)];
  238. var downloadlink= "<ahref='download.php?" +tempPlace+ "'onFocus='blur();'>Clickhere"
  239. "</a>todownloadthecodeyou'llneed" ;
  240. var tmpIncome=addSpaces(strIncome);
  241. //removecommaiflessthen999.
  242. if (strIncome<=999){
  243. tmpIncome=tmpIncome.replace( "," , "" );
  244. }
  245. //sethtmlforboxes
  246. var nbrRichest1= "=" +strPlaceRicher2;
  247. var nbrRichest2=strPlaceRicher2;
  248. var nbrPercent= "TOP" +strPercentagePoorer+ "%" ;
  249. //dontprintinfoboxestopageifpoor
  250. if (!ourpoor){
  251. layerWrite( 'nbrRichest1' , null ,nbrRichest1);
  252. layerWrite( 'nbrRichest2' , null ,nbrRichest2);
  253. layerWrite( 'nbrPercent' , null ,nbrPercent);
  254. }
  255. //mainboxwithlotsofcopy
  256. layerWrite( 'copybox' , null ,copybox);
  257. //Didyouknow
  258. layerWrite( 'didyou' , null ,didyou);
  259. //linktodownloadpage.
  260. layerWrite( 'downloadlink' , null ,downloadlink);
  261. //thelittleboxdownonpage.
  262. layerWrite( 'helpboxrichest' , null ,strPlaceRicher2);
  263. //movetorightplaceonline
  264. //andshowstheresultblock
  265. fn_move_pos(currpos);
  266. }
  267. }
  268. //reversesastringoftext
  269. function reverse(value){
  270. for ( var text= '' ,i=value.length-1;i>-1;i=i-1){
  271. text+=value.charAt(i);
  272. }
  273. return text;
  274. }
  275. function addDecimals(value,nbrOfDecimals){
  276. value=value.toString();
  277. var dotIndex=value.lastIndexOf( '.' );
  278. if (dotIndex<0){
  279. var decimal= "" ;
  280. for (i=0;i<nbrOfDecimals;i++)
  281. decimal+= "0" ;
  282. } else {
  283. return value.substring(0,dotIndex+nbrOfDecimals+1);
  284. }
  285. }
  286. //displayanswer
  287. function layerWrite(id,nestref,text){
  288. if (ns4){
  289. var lyr=(nestref)?
  290. eval( 'document.' +nestref+ '.document.' +id+ '.document' ):document.layers[id].document
  291. lyr.open()
  292. lyr.write(text)
  293. lyr.close()
  294. }
  295. if (ie4){
  296. document.all[id].innerHTML=text;
  297. }
  298. //NS6
  299. if (ns6){
  300. document.getElementById(id).innerHTML=text;
  301. }
  302. }
  303. function addSpaces(str){
  304. //reversethestring
  305. str=reverse(str);
  306. //makearray
  307. for (i=0;i<str.length;i++){
  308. arrPlace[i]=str.charAt(i);
  309. }
  310. var str2= "" ;
  311. //addspaces
  312. for (i=0;i<str.length;i++){
  313. if ((i==2)||(i==5&&(str.length!=6))||(i==8&&(str.length!=9))){
  314. str2=str2+arrPlace[i]+ ","
  315. } else {
  316. str2=str2+arrPlace[i];
  317. }
  318. }
  319. //reverseitbackagainandreturn.
  320. str=reverse(str2);
  321. return str;
  322. }
  323. //includesthenews
  324. function fnInclude(){
  325. if (ie4){
  326. document.all.news.style.visibility= 'visible' ;
  327. if (iswin){
  328. document.all.news.style.top=795;
  329. } else {
  330. document.all.news.style.top=775;
  331. }
  332. } else if (ns4){
  333. document.news.visibility= 'show' ;
  334. document.news.top=795;
  335. } else if (ns6){
  336. document.getElementById( 'news' ).style.visibility= 'visible' ;
  337. document.getElementById( 'news' ).style.top=795;
  338. }
  339. }
  340. //hidesthenews
  341. function fnIncludeHide(){
  342. if (ie4){
  343. document.all.news.style.visibility= 'hidden' ;
  344. if (iswin){
  345. document.all.news.style.top=795;
  346. } else {
  347. document.all.news.style.top=775;
  348. }
  349. } else if (ns4){
  350. document.news.visibility= 'hide' ;
  351. document.news.top=795;
  352. } else if (ns6){
  353. document.getElementById( 'news' ).style.visibility= 'hidden' ;
  354. document.getElementById( 'news' ).style.top=795;
  355. }
  356. }
  357. //movesthepositiongraphicANDshowstheresultblock
  358. function fn_move_pos(topos){
  359. var nowpos=0;
  360. if (ie4){
  361. nowpos=document.all.redman.style.left;
  362. document.all.resultblock.style.display= 'block' ;
  363. document.all.resultblock.style.visibility= 'visible' ;
  364. } else if (ns4){
  365. nowpos=document.redman.left;
  366. document.resultblock.visibility= 'show' ;
  367. document.resultblock.display= 'block' ;
  368. } else if (ns6){
  369. nowpos=document.getElementById( 'redman' ).style.left;
  370. document.getElementById( 'resultblock' ).style.display= 'block' ;
  371. document.getElementById( 'resultblock' ).style.visibility= 'visible' ;
  372. }
  373. if (!nowpos){
  374. nowpos=redman_startpos;
  375. } else {
  376. nowpos=nowpos.substring(0,nowpos.indexOf( 'p' ));
  377. }
  378. if (ie4&&ismac&&!isopera){
  379. document.all.redman.style.left=topos;
  380. } else {
  381. endpos=topos-nowpos;
  382. new Effect.ScrollTo( 'resultblock' ,{duration:1.0});
  383. new Effect.MoveBy( 'redman' ,0,endpos,{duration:1.3,queue: 'end' });
  384. }
  385. return false ;
  386. }
  387. function hide_pos(){
  388. if (ie4){
  389. document.all.arr.style.visibility= 'hidden' ;
  390. document.all.line.style.visibility= 'hidden' ;
  391. } else if (ns4){
  392. document.arr.visibility= 'hide' ;
  393. document.line.visibility= 'hide' ;
  394. } else if (ns6){
  395. document.getElementById( 'arr' ).style.visibility= 'hidden' ;
  396. document.getElementById( 'line' ).style.visibility= 'hidden' ;
  397. }
  398. }
  399. function whatkey(){
  400. if (ie4||ns6){
  401. thekey=window.event.keyCode;
  402. if (thekey==13&&iswin){
  403. fnSubmit();
  404. }
  405. }
  406. }

你可能感兴趣的:(PHP,Opera)