associative array problem

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Joseph Norris

    associative array problem


    Hello to all,


    I am having a problem with this test html below. When I enter a correct
    city I keep getting an "Object expected" error on the town field.

    Any and all comments appreciated. Is there a better way to do this?

    Thanks.


    <html>
    <head>
    <title>Test</title

    <SCRIPT language="JAVAS CRIPT">

    <!-- //

    function PutZip(t){
    var find_zip = new Array();
    find_zip["ALBION"] = "95410";
    find_zip["BOONVILLE"] = "95415";
    document.testFo rm.zip.value = find_zip[t];
    }

    // -->

    </SCRIPT>

    </head>

    <BODY>
    <form action="" name="testForm" >
    <input type="text" name="town" size="30" maxlength="30" onblur="return PutZip(this.val ue)">
    <input type="text" name="zip" size="30" maxlength="30">
    </form>
    </body>
    </html>

    #Joseph Norris (Perl - what else is there?/Linux/CGI/Mysql)
    print @c=map chr $_+100,(6,17,15 ,16,-68,-3,10,11,16,4,1, 14,-68,12,1,14,8,
    -68,4,-3,-1,7,1,14,-68,-26,11,15,1,12,4 ,-68,-22,11,14,14,5,1 5,-90);


  • Joseph Norris

    #2
    Re: associative array problem


    Found the problem and again has made me even more cautious about using
    javascript. I forgot the ">" on title - IE kicked it back but netscape
    accepted it. Yuck!!!!


    #Joseph Norris (Perl - what else is there?/Linux/CGI/Mysql)
    print @c=map chr $_+100,(6,17,15 ,16,-68,-3,10,11,16,4,1, 14,-68,12,1,14,8,
    -68,4,-3,-1,7,1,14,-68,-26,11,15,1,12,4 ,-68,-22,11,14,14,5,1 5,-90);


    On Wed, 13 Aug 2003, Joseph Norris wrote:
    [color=blue]
    >
    > Hello to all,
    >
    >
    > I am having a problem with this test html below. When I enter a correct
    > city I keep getting an "Object expected" error on the town field.
    >
    > Any and all comments appreciated. Is there a better way to do this?
    >
    > Thanks.
    >
    >
    > <html>
    > <head>
    > <title>Test</title
    >
    > <SCRIPT language="JAVAS CRIPT">
    >
    > <!-- //
    >
    > function PutZip(t){
    > var find_zip = new Array();
    > find_zip["ALBION"] = "95410";
    > find_zip["BOONVILLE"] = "95415";
    > document.testFo rm.zip.value = find_zip[t];
    > }
    >
    > // -->
    >
    > </SCRIPT>
    >
    > </head>
    >
    > <BODY>
    > <form action="" name="testForm" >
    > <input type="text" name="town" size="30" maxlength="30" onblur="return PutZip(this.val ue)">
    > <input type="text" name="zip" size="30" maxlength="30">
    > </form>
    > </body>
    > </html>
    >
    > #Joseph Norris (Perl - what else is there?/Linux/CGI/Mysql)
    > print @c=map chr $_+100,(6,17,15 ,16,-68,-3,10,11,16,4,1, 14,-68,12,1,14,8,
    > -68,4,-3,-1,7,1,14,-68,-26,11,15,1,12,4 ,-68,-22,11,14,14,5,1 5,-90);
    >
    >
    >[/color]

    Comment

    • kaeli

      #3
      Re: associative array problem

      In article <Pine.LNX.4.40. 0308130940001.2 2124-100000@bolt.son ic.net>,
      jozefn@bolt.son ic.net enlightened us with...[color=blue]
      >
      > Hello to all,
      >
      >
      > I am having a problem with this test html below. When I enter a correct
      > city I keep getting an "Object expected" error on the town field.
      >
      > Any and all comments appreciated. Is there a better way to do this?
      >
      > Thanks.
      >[/color]

      You forgot to end the title tag's last ">". Fix that and it works.
      <html>
      <head>
      <title>Test</title>

      <SCRIPT language="JAVAS CRIPT">

      <!-- //

      function PutZip(t){
      var find_zip = new Array();
      find_zip["ALBION"] = "95410";
      find_zip["BOONVILLE"] = "95415";
      document.testFo rm.zip.value = find_zip[t];
      }

      // -->

      </SCRIPT>

      </head>

      <BODY>
      <form action="" name="testForm" >
      <input type="text" name="town" size="30" maxlength="30"
      onblur="return PutZip(this.val ue)">
      <input type="text" name="zip" size="30" maxlength="30">
      </form>
      </body>
      </html>

      -------------------------------------------------
      ~kaeli~
      Why do people who know the least know it the loudest?
      If that cell phone was up your a$$, maybe you could
      drive a little better!


      -------------------------------------------------

      Comment

      Working...