Displaying arrayed data

Results 1 to 2 of 2

Thread: Displaying arrayed data

  1. #1
    Join Date
    Dec 1969

    Default Displaying arrayed data

    I have a 2d array which is storing countries and a few details. I allow the user to start typing in a country name and a list is shown of all those that match the typing until it is narrowed down to the country which is displayed. This is done with the following code.<BR><BR>&#060;code&#062;<BR>function listcountries()<BR> {<BR> var sCountry = document.mycountry.txtCountry.value;<BR> var sCurrentSelection, sFalseSelection<BR> <BR> var resultnode = document.getElementById("results");<BR> resultnode.firstChild.nodeValue = "";<BR> if(sCountry != "")<BR> {<BR> for(a = 0; a &#060; javaArray[0].length; a++)<BR> {<BR> var sCurrentCountry = javaArray[0][a];<BR> sSearch = sCountry.toUpperCase();<BR> if(sCurrentCountry.search(sSearch) &#062;= 0) resultnode.firstChild.nodeValue += sCurrentCountry + "
    ";<BR> }<BR> }<BR> }<BR>&#060;/code&#062;<BR><BR>Now as you can see this is displayed by passing the value to the nodeValue but instead I want to put it into a table. I tried document.write to achieve this and it went horribly wrong.<BR><BR>Any ideas?

  2. #2
    Join Date
    Dec 1969

    Default Putting it into a table on the fly...

    ...is going to be a lot more complex in JavaScript (i.e. client-side), which I think is what you&#039;re doing. You can read up on the subject, of course, or try and find some free JavaScripts that&#039;ll do the job for you or that you can steal ideas from, but I don&#039;t think anybody here&#039;ll have the time to walk you through the process - but then I may be wrong.<BR><BR>Oliver.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts