Wrox Programmer Forums
Javascript General Javascript discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old August 3rd, 2006, 03:55 AM
Friend of Wrox
Join Date: May 2005
Posts: 140
Thanks: 0
Thanked 0 Times in 0 Posts
Default Array problem

Hallo everyone

I am having a code chunk which doesn't work as I expected.


        myArray6[i] = xmldoc.selectNodes("//fcs:folder/fcs:folderHeadlinesResultSet/fcs:folderHeadline/fcs:contentParts/fcs:part/@type")[i];
        if (myArray6[i].value=="NewsArticle") {
          article1[i] = xmldoc.selectNodes("//fcs:folder/fcs:folderHeadlinesResultSet/fcs:folderHeadline/fcs:contentParts/fcs:part/@reference")[i].value;
        article = article1[i];
        myArray1[i] = xmldoc.selectNodes("//fcs:folder/fcs:folderHeadlinesResultSet/fcs:folderHeadline/fcs:baseLanguage")[i];
        myArray2[i] = xmldoc.selectNodes("//fcs:folder/fcs:folderHeadlinesResultSet/fcs:folderHeadline/fcs:wordCount")[i];
        myArray3[i] = xmldoc.selectNodes("//fcs:folder/fcs:folderHeadlinesResultSet/fcs:folderHeadline/fcs:publicationDate")[i];
        myArray4[i] = xmldoc.selectNodes("//fcs:folder/fcs:folderHeadlinesResultSet/fcs:folderHeadline/fcs:publicationTime")[i];
        myArray5[i] = xmldoc.selectNodes("//fcs:folder/fcs:folderHeadlinesResultSet/fcs:folderHeadline/fcs:headline/fcs:paragraph")[i];
        row = myTable.insertRow(i+1);
        myCell.innerText = myArray1[i].text;
        myCell2 = row.insertCell(1);
        myCell2.innerText = myArray2[i].text;
        myCell3 =row.insertCell(2);
        myCell3.innerHTML ="<a href = '#' onclick = 'popUp(article,i)'>"+ myArray5[i].text+"</a>";
        myCell4 = row.insertCell(3);
        myCell4.innerText = myArray3[i].text;

      } while(i<size)
function popUp(article,i) {
               window.open("","Factiva","status=1,scrollbars=1,wi dth=600,height=600");
                   this.article1[i]= article;

I have already declared article array and variable i as global but it always takes the info of the last array element in the list. For example I have 5 records

en 273 Support crew 2006-08-03
en 626 Our united front - Tongan-raised Palu joins Wallabies' international pack 2006-08-03
en 360 More positives likely as drug group sets targets 2006-08-03
en 185 The Quiz 2006-08-03
en 200 Lions test young ruck hopefuls 2006-08-03

And the headlines are the links which lead them to their articles but when I click on them I am always getting the last array value. How can I solve this problem?

Your attitude determines your altitude
Your attitude determines your altitude

Similar Threads
Thread Thread Starter Forum Replies Last Post
Array Problem...Can anyone help?? :( Shuchik Classic ASP Basics 1 September 25th, 2007 05:21 AM
Array problem Ivanchan Excel VBA 2 July 24th, 2007 08:28 PM
problem in getting the value of an array knightneo Beginning PHP 0 December 4th, 2006 10:23 PM
Array Problem monika.vasvani ASP.NET 1.0 and 1.1 Professional 3 September 13th, 2006 05:56 AM
Array Problem hayley Classic ASP Basics 4 February 2nd, 2005 12:42 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.