AFAIK, JavaScript for-each is for iterating properites of an object, not elements of an array.
You need something like:
[js]var te = document.getElementsByName('subject'); for(i=0; i< te.legth; i++) { document.write(te.innerHTML);}[/js]
There are 10 types of people in this world, those who understand binary and those who don't
@Syntac: Thanks a lot... The problem is that it doesn't show anything... I mean it shows in firebug that the command is being executed but it doesn't print anything... The id value was :ms
As for the purpose, I am trying to develop a firefox extension for myself to keep track of the people whom I am emailing in a text file along with the subject line.
@VladSun
Thanks... I used even that but that wasn't printing anything either... It shows that it has grabbed a HTML Object but doesn't show anything when I ask it to print something... Any other advice please?
Oh... Its Gmail itself... I mean the page that shows up when I hit the Compose Mail link after logging into Gmail... I am just trying to hook up some code so that I can grab the subject line when I click on the Send button and save it into a file.
Google uses IFRAMEs - thats why you can't access directly from window.document
[js]alert(document.getElementById("canvas_frame").contentDocument.getElementById(':nz').value)[/js]
Last edited by VladSun on Wed Oct 22, 2008 3:26 pm, edited 1 time in total.
There are 10 types of people in this world, those who understand binary and those who don't
Ah.... Wonderful solution... Thanks a lot! Works like a charm
Perhaps the last thing that I should do is to hook up an onClick event to the Send button so that it can grab that data... I will now try that.. Thank You again...