Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 3 of 3
  1. #1
    Member web101's Avatar
    Join Date
    Jan 2009
    Posts
    74
    Member #
    18165
    Hey guys, well I'm trying to figure this out but it's not working really well. I have some code so that when you click on a state, it shows up in a box. Now I have it calling functions from a different JS page. The code works fine when I use only one function on the page, but I need to include 50+. Here's my code that should work, but doesn't...

    Code:
    function me(){
    	document.getElementById('states').innerHTML = 'ME';
    }
    
    function vt(){
    	document.getElementById('states').innerHTML = 'VT';
    }
    
    function ma(){
    	document.getElementById('states').innerHTML = 'MA';
    }
    
    function ri(){
    	document.getElementById('states').innerHTML = 'RI';
    }
    
    function ct(){
    	document.getElementById('states').innerHTML = 'CT';
    }
    
    function ny(){
    	document.getElementById('states').innerHTML = 'NY';
    }
    
    function nj){
    	document.getElementById('states').innerHTML = 'NJ';
    }
    
    function de(){
    	document.getElementById('states').innerHTML = 'DE';
    }
    
    function md(){
    	document.getElementById('states').innerHTML = 'MD';
    }
    
    function pa(){
    	document.getElementById('states').innerHTML = 'PA';
    }
    
    function wv(){
    	document.getElementById('states').innerHTML = 'WV';
    }
    
    function va(){
    	document.getElementById('states').innerHTML = 'VA';
    }
    
    function nc(){
    	document.getElementById('states').innerHTML = 'NC';
    }
    
    function sc(){
    	document.getElementById('states').innerHTML = 'SC';
    }
    
    function ga(){
    	document.getElementById('states').innerHTML = 'GA';
    }
    
    function fl(){
    	document.getElementById('states').innerHTML = 'FL';
    }
    
    function al(){
    	document.getElementById('states').innerHTML = 'AL';
    }
    
    function ms(){
    	document.getElementById('states').innerHTML = 'MS';
    }

  2.  

  3. #2
    Member web101's Avatar
    Join Date
    Jan 2009
    Posts
    74
    Member #
    18165
    And here's the code for the map:

    HTML Code:
    <map name="map" id="map">
    	<area onclick="me();" shape="poly" coords="532,77,522,52,525,51,527,47,526,38,525,29,528,18,532,20,536,15,541,18,546,34,560,45" href="#Maine" />
    	<area onclick="nh();" shape="poly" coords="517,83,517,64,523,56,532,81,519,86" href="#New Hampshire" />
    	<area onclick="vt();" shape="poly" coords="502,58,505,78,508,84,511,92,519,88,516,66,520,55" href="#Vermont" />
      	<area onclick="ma();" shape="poly" coords="543,91,546,94,538,98,533,94,532,92,512,100,512,93,533,81,518,86,531,85,538,87" href="#Massachusetts" />
      	<area onclick="ri();" shape="poly" coords="528,95,531,104,536,98,531,94" href="#Rhode Island" />
      	<area onclick="ct();" shape="poly" coords="513,101,515,111,529,104,528,96,524,97" href="#Connecticut" />
    	<area onclick="ny();" shape="poly" coords="529,110,519,118,510,119,494,104,453,114,449,109,455,104,453,97,458,94,471,92,479,85,472,78,480,75,481,67,498,61,490,62,501,61,504,78,511,92,510,100,514,110,514,114,511,112" href="#New York" />
     	<area onclick="nj();" shape="poly" coords="501,134,507,140,512,125,509,123,511,114,502,109,500,112,497,121,505,127,506,125,500,132" href="#New Jersey" />
     	<area onclick="de();" shape="poly" coords="495,136,500,152,507,148,498,134" href="#Delaware" />
      	<area onclick="md();" shape="poly" coords="502,167,506,156,507,149,501,153,492,137,460,142,460,148,465,147,473,144,479,146,483,147" href="#Maryland" />
      	<area onclick="pa();" shape="poly" coords="448,145,443,114,449,109,453,114,494,105,500,110,497,121,503,127,497,135" href="#Pennsylvania" />
      	<area onclick="wv();" shape="poly" coords="436,176,429,167,432,159,447,145,458,145,447,149,459,145,461,150,470,147,464,160,457,162,452,178" href="#West Virginia" />
      	<area onclick="va();" shape="poly" coords="427,190,437,178,450,180,458,163,465,162,471,146,485,150,495,163,502,176" href="#Virginia" />
      	<area onclick="nc();" shape="poly" coords="418,216,431,214,439,207,450,206,455,208,468,209,484,221,487,217,497,205,501,204,511,193,505,176,446,185,441,198,432,197,420,212" href="#North Carolina" />
      	<area onclick="sc();" shape="poly" coords="430,215,436,220,445,230,457,238,459,250,485,221,470,210,449,205,438,208" href="#South Carolina" />
      	<area onclick="ga();" shape="poly" coords="415,275,415,251,405,216,429,215,445,231,455,238,459,251,456,267,451,272,450,276,445,272" href="#Georgia" />
      	<area onclick="fl();" shape="poly" coords="387,275,386,283,398,282,409,284,416,290,429,282,439,289,445,292,445,311,456,326,462,335,470,341,463,351,471,349,479,339,481,325,476,310,470,298,462,284,458,270,452,275,445,272,418,277,413,271" href="#Florida" />
      	<area onclick="al();" shape="poly" coords="377,284,374,221,403,218,412,247,413,272,389,272,384,282" href="#Alabama" />
      	<area onclick="ms();" shape="poly" coords="341,277,348,260,345,251,346,234,354,221,373,220,376,285,365,288,362,278" href="#Mississippi" />
      	<area onclick="la();" shape="poly" coords="313,297,319,278,312,266,311,246,316,250,342,250,347,259,342,278,361,279,364,289,363,297,368,302,358,303,348,305,341,294,330,302" href="#Louisiana" />
      	<area onclick="tn();" shape="poly" coords="356,220,361,200,372,199,445,187,442,198,432,196,419,216" href="#Tennasee" />
     	<area onclick="ky();" shape="poly" coords="363,198,365,191,370,191,371,182,386,178,405,160,415,165,427,164,436,178,424,189" href="#Kentucky" />
      	<area onclick="oh();" shape="poly" coords="407,160,400,124,413,121,423,125,431,123,439,116,447,143,431,159,430,163,415,162,421,163" href="#Ohio" />
      	<area onclick="mi();" shape="poly" coords="381,124,387,112,381,101,381,89,395,68,400,73,405,76,410,86,405,95,406,103,414,91,419,101,420,111,412,122" href="#Michigan" />
      	<area onclick="mi();" shape="poly" coords="341,62,353,70,366,74,367,85,371,70,381,70,390,64,399,66,400,54,360,46" href="#Michigan" />
      	<area onclick="in();" shape="poly" coords="375,180,375,129,384,125,400,124,408,160,388,177" href="#Indiana" />
      	<area onclick="il();" shape="poly" coords="364,192,356,184,348,177,350,170,344,169,334,154,338,150,339,138,347,127,344,124,340,120,368,116,373,130,375,180,368,180,369,189" href="#Illinois" />
      	<area onclick="wi();" shape="poly" coords="339,121,335,106,319,91,316,78,324,73,322,65,336,59,364,77,365,90,373,80,367,113,368,116" href="#Wisconsin" />
      	<area onclick="mn();" shape="poly" coords="286,108,286,86,280,80,283,74,280,33,298,33,323,45,343,43,322,66,324,73,316,80,318,90,337,107" href="#Minnesota" />
      	<area onclick="ia();" shape="poly" coords="285,108,284,123,292,148,337,148,338,138,346,127,341,120,335,107" href="#Iowa" />
      	<area onclick="mo();" shape="poly" coords="293,150,301,157,299,163,309,171,305,198,354,200,352,207,360,206,365,194,347,177,349,171,344,169,334,154,339,148" href="#Missouri" />
      	<area onclick="ar();" shape="poly" coords="309,243,307,199,352,203,348,208,358,207,356,220,346,234,344,247,314,248,341,248,318,251" href="#Arkansas" />
      	<area onclick="nd();" shape="poly" coords="215,73,219,31,278,32,281,76" href="#North Dakota" />
      	<area onclick="sd();" shape="poly" coords="209,112,216,74,279,77,285,85,282,121,276,115,270,117,264,114" href="#South Dakota" />
      	<area onclick="ne();" shape="poly" coords="209,136,210,113,264,114,267,116,275,117,282,122,292,152,294,154,229,152,226,142,228,139" href="#Nebraska" />
      	<area onclick="ks();" shape="poly" coords="227,192,227,152,294,155,301,159,294,163,309,172,304,197" href="#Kansas" />
      	<area onclick="ok();" shape="poly" coords="213,199,214,192,306,199,309,244,291,241,271,243,256,235,246,233,247,202" href="#Oklahoma" />
      	<area onclick="tx();" shape="poly" coords="168,258,170,270,184,280,188,296,201,303,212,294,224,294,242,318,253,338,274,348,273,324,312,299,317,278,310,268,311,245,290,242,276,245,255,237,245,233,246,203,213,200,209,259" href="#Texas" />
      	<area onclick="mt();" shape="poly" coords="115,16,110,30,120,50,115,61,123,61,129,82,148,79,211,86,218,30" href="#Montana" />
      	<area onclick="wy();" shape="poly" coords="137,127,145,79,213,87,209,105,209,138" href="#Wyoming" />
      	<area onclick="co();" shape="poly" coords="153,184,161,132,227,140,228,149,226,191" href="#Colorado" />
      	<area onclick="nm();" shape="poly" coords="140,261,153,182,213,190,208,257,151,253,149,263" href="#New Mexico" />
      	<area onclick="id();" shape="poly" coords="79,105,90,74,86,73,99,61,95,49,106,13,114,16,109,27,119,49,115,60,122,64,128,82,145,81,136,114" href="#Idaho" />
      	<area onclick="ut();" shape="poly" coords="98,175,111,112,135,113,135,125,160,130,153,184" href="#Utah" />
      	<area onclick="az();" shape="poly" coords="80,236,117,255,135,263,152,186,99,174,92,192,89,191,89,214" href="#Arizona" />
      	<area onclick="wa();" shape="poly" coords="34,34,41,37,44,47,95,51,105,12,60,1,57,14,51,20,49,11,38,6" href="#Washington" />
      	<area onclick="or();" shape="poly" coords="79,102,11,85,34,34,42,37,42,49,94,52,98,62,85,72,89,77" href="#Oregon" />
      	<area onclick="nv();" shape="poly" coords="53,98,42,134,87,199,89,190,93,191,97,174,110,112" href="#Nevada" />
     	<area onclick="ca();" shape="poly" coords="78,234,51,233,41,209,30,198,21,197,21,185,13,166,14,158,7,150,6,108,12,88,53,97,42,135,87,200,85,216" href="#California" />
      	<area onclick="ak();" shape="poly" coords="0,370,133,345,101,312,84,315,69,256,26,252,6,252,0,252" href="#Alaska" />
      	<area onclick="hi();" shape="poly" coords="139,322,159,355,193,364,221,362,197,331,158,320" href="#Hawaii" />
      	<area onclick="dc();" shape="rect" coords="514,182,535,196" href="#Washington DC" />
      	<area onclick="md();" shape="rect" coords="517,160,540,174" href="#Maryland" />
      	<area onclick="de();" shape="rect" coords="531,141,550,156" href="#Delaware" />
      	<area onclick="nj();" shape="rect" coords="519,125,538,138" href="#New Jersey" />
      	<area onclick="ct();" shape="rect" coords="532,113,549,125" href="#Connecticut" />
      	<area onclick="ri();" shape="rect" coords="558,94,571,108" href="#Rhode Island" />
      	<area onclick="ma();" shape="rect" coords="549,72,568,86" href="#Massachusetts" />
      	<area onclick="nh();" shape="rect" coords="502,29,522,42" href="#New Hampshire" />
      	<area onclick="vt();" shape="rect" coords="476,29,496,44" href="#Vermont" />
    </map>

  4. #3
    Member web101's Avatar
    Join Date
    Jan 2009
    Posts
    74
    Member #
    18165
    Can anyone help me?


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 05:14 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com