Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old August 3rd, 2006, 03:55 AM
Friend of Wrox
 
Join Date: May 2005
Location: Nürnberg/München, , Germany.
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.

   do{

        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;
        }
        alert(article1[i]);
        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=row.insertCell(0);
        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;


    i++;
      } while(i<size)
   }
}
function popUp(article,i) {
               window.open("","Factiva","status=1,scrollbars=1,wi dth=600,height=600");
                   alert(i);
                   this.article1[i]= article;
                   alert(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
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 05:41 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.