By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,144 Members | 1,056 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,144 IT Pros & Developers. It's quick & easy.

can't get the values out of an array

100+
P: 132
Hi all,

I'm having yet another problem with arrays. I'm trying to create an application which checks the lotterynumbers to see if I have won ;-)

What I want to do is compare two arrays with eachother. One array are the numbers of that week, the other array are my numbers which I play with.

Now browsing the around on the net I've found a script which I adapted to my needs however I can't get the value into the new array.

Expand|Select|Wrap|Line Numbers
  1. <HTML>
  2. <HEAD>
  3. <SCRIPT>
  4. function getElementsByStyleClass (className) {
  5.   var page = window.frames["lottoframe"].document.all ? window.frames["lottoframe"].document.all :
  6.     window.frames["lottoframe"].document.getElementsByTagName('td');
  7.   var nummers = new Array();
  8.   for (var i = 0; i < page.length; i++)
  9.     if (page[i].className == className)
  10. document.form.output.value += "test" + " " + page[i].innerhtml + "\n";
  11. }
  12.  
  13. function execute() {
  14. getElementsByStyleClass("Numbers");
  15. }
  16.  
  17. </SCRIPT>
  18.  
  19. </HEAD>
  20. <BODY>
  21. <iframe name="lottoframe" width="800" height="100" src="http://www.lotto.be/pages/show.aspx?Culture=nl&pageid=results/latest/lotto" scrolling="no" marginwidth="0" marginheight="0"></iframe>
  22. <br>
  23. <form name="form">
  24. <textarea name="output" cols="40" rows="10"></textarea>
  25. <br>
  26. <input type="button" value="Execute" onclick="javascript:execute()">
  27. </form>
  28. </BODY>
  29. </HTML>
  30.  
If I execute this code I get the 6 instances which correspond with the 6 numbers but I don't get the value. The problem is that I don't know how to get that value. If someone out there can help me, that would be appreciated.

One last remark, if you want to test the code you need to save the htm as .hta, otherwise you can't access the website to get the values out of it.

Thanks
Jan 3 '08 #1
Share this Question
Share on Google+
3 Replies


gits
Expert Mod 5K+
P: 5,333
hi ...

line 10 should be:

Expand|Select|Wrap|Line Numbers
  1. document.form.output.value += "test" + " " + page[i].innerHTML + "\n";
kind regards
Jan 4 '08 #2

100+
P: 132
Gits, yet again to the rescue!

Offcourse, silly me... Caps did it again.

Thanks mate!
Jan 4 '08 #3

gits
Expert Mod 5K+
P: 5,333
no problem :) ... post back to the forum anytime you have more questions ...

kind regards
Jan 4 '08 #4

Post your reply

Sign in to post your reply or Sign up for a free account.