Jump to content

Search the Community

Showing results for tags 'arrays'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • W3Schools
    • General
    • Suggestions
    • Critiques
  • HTML Forums
    • HTML/XHTML
    • CSS
  • Browser Scripting
    • JavaScript
    • VBScript
  • Server Scripting
    • Web Servers
    • Version Control
    • SQL
    • ASP
    • PHP
    • .NET
    • ColdFusion
    • Java/JSP/J2EE
    • CGI
  • XML Forums
    • XML
    • XSLT/XSL-FO
    • Schema
    • Web Services
  • Multimedia
    • Multimedia
    • FLASH

Calendars

  • Community Calendar

Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Languages

Found 8 results

  1. I recently used PHP's json_encode( ) function to covert an array created with PHP into a JSON encoded object, as the conversion appeared normal, I then assigned the value to a Javascript variable using PHP's echo construct and reproduced it with a JS alert. This too, appeared normal. My difficulty arose when I tried using the jQuery .map( ) method to convert my nested Javascript object into a nested Javascript array. I received the following error message in my Console: TypeError: e is not an Object. (evaluating 't-1 in e') Am I being foolish to believe that I need a nested array when I already have a nested object? If not, is there not a routine to perform this very conversion?
  2. Hello, I'm trying to make some kind of leaderboard, such as the example below: var game = ["Dominoes",95,"Cards",22,"Chess",65]; The idea is to try to group all of the numbers together in the array so that I can return a position on them. For example: 95 - would return 1st place (for the most points) 65 - 2nd place 22 - 3rd place But the numbers in the "game" variable would also need to be linked in with the games so that if they were sorted numerically then the games would follow suit as well. Would anyone be able to help with this, please? I'd be grateful for any assistance. Many thanks,Dan.
  3. Hello internet, There is a webpage I would like to start building but I need to be able to pull data from other webpages. The information is public info so it’s nothing sketchy but I don’t know where to start. I began with just doing google searches but it appears it is more involved than I originally thought. If you have any recommendations on tutorials or Forum discussions I would be grateful. Thanks.
  4. Hi, I am fairly new to javascript and still finding my feet so if i am not been clear in my question let me know. I am using the chart.js to build graphs in my docuemnts and it works great, I am now trying to expand this by linking to an xml file I have set up. If I use the following code I can retrieve the data fine: xmlDoc=loadXMLDoc("rego.xml");var nSubOrg = xmlDoc.getElementsByTagName('SubOrg');var nRev = xmlDoc.getElementsByTagName('Revenue');var nCol = xmlDoc.getElementsByTagName('Colour');var nHL = xmlDoc.getElementsByTagName('HLight'); //chart data for Chart.JS var dData = [ { value: (nRev[0].childNodes[0].nodeValue), color: (nCol[0].childNodes[0].nodeValue), highlight: (nHL[0].childNodes[0].nodeValue), label: (nSubOrg[0].childNodes[0].nodeValue) }, { value: (nRev[1].childNodes[0].nodeValue), color: (nCol[1].childNodes[0].nodeValue), highlight: (nHL[1].childNodes[0].nodeValue), label: (nSubOrg[1].childNodes[0].nodeValue) }, { value: (nRev[2].childNodes[0].nodeValue), color: (nCol[2].childNodes[0].nodeValue), highlight: (nHL[2].childNodes[0].nodeValue), label: (nSubOrg[2].childNodes[0].nodeValue) }]; However I am trying to make this a bit more functional so want to loop through to create the multidimension array. I have found other snippets which gve me an idea about how to do this but I just can't get it work. I think something like this should but can't get my head round the exact syntax: xmlDoc=loadXMLDoc("rego.xml");var nSubOrg = xmlDoc.getElementsByTagName('SubOrg');var nRev = xmlDoc.getElementsByTagName('Revenue');var nCol = xmlDoc.getElementsByTagName('Colour');var nHL = xmlDoc.getElementsByTagName('HLight');//try and build arrayvar dData=new array[()]for (i=0; i<nRev.length; i++) { dData[i].push( value: (nRev[i].childNodes[0].nodeValue), color: (nCol[i].childNodes[0].nodeValue), highlight: (nHL[i].childNodes[0].nodeValue), label: (nSubOrg[i].childNodes[0].nodeValue) ); }; Any help would be appreciated. Cheers Soggy
  5. sorting arrays

    Hi, I am generating a bunch of arrays but I would like to change the order of these. This is my code now: $players_killed['time'] = strtotime($time);$players_killed['name'] = ': '.$player;arsort($players_killed, SORT_NUMERIC);echo var_dump($players_killed) .'<br>'; And this is the output: array(2) { ["time"]=> int(1334027580) ["name"]=> string(106) ": Brbasher" }array(2) { ["time"]=> int(1334029860) ["name"]=> string(102) ": Dynext" }array(2) { ["time"]=> int(1334029260) ["name"]=> string(110) ": Kronigrass" }array(2) { ["time"]=> int(1334036580) ["name"]=> string(108) ": Poliminia" } How can I make them order by the time value? My attempt with arsort($players_killed, SORT_NUMERIC); sure failed.
  6. Hello internet. I have been looking around and I'm not sure I have found the method to use to complete this task. Here it is:- I want the user to send three numerical guesses to my database (this is no problem)- I will submit my own three numbers that will be the actual numbers the user will be trying to guess (this is no problem)- I want to send all those rows through a check function and then assign a value for each row based on how well they did guessing the number (this is where I am having an issue)- I would then like to echo back to the user all the guess totals - along with the names - in a table (this will not be a problem) I think I can handle all of this except how to write the function and send all the rows in mysql through that function and then assign a "total" value for each row based on how well then did guessing. Your help is appreciated.
  7. Hello,this maybe very stupid question but I need to know.I have one xml file and I use xslt 2.0 to create new xml file.During the creation I calculate some values for each element of the new xml file (node -> new xml represents graph)The thing is that some values depends on the values that I already previously calculated. The values are coordinates of the nodes in the GUI representation of the graph, by the way.So I need some kind of dynamic array which seems impossible in xsl, right?If the arrays are not possible than it would be convenient to access the part of new xml that I already created and to access the values that I already calculated. Which of these two is possible? Can you give me some example or some explanation, please?thanks
  8. I need to access an array value but don't know all the values to call until I get them from a different array value. I'm not explaining this well so I will show some of the code below (This is from a drupal based website). I want to access this value: $variables[taxonomy][taxonomy_term_1083][title]The problem is I don't know the term id (1083) until I have accessed this value: $variables[field_journal_name][0][value] I have tried creating a string that combines the term id with the rest of the array: $termid = $variables[field_journal_name][0][value]; $taxname = 'variables[taxonomy][taxonomy_term_'.$termid.'][title]';and then using the variable variable method: $name = ${$taxname};and many different variations of this but nothing seems to work. Any ideas would be greatly appreciated. Thanks - Dave.
×