JavaScript problem getting page content with no fields

I have webpage that just contains plain and text, no fields, that I get information from. Is there a way of getting the stuff written in the /body of this page and put it into a field. I cannot change anything in the design of this page, I just query it througt an url.

Thanks in advance for any clues!

Subject: JavaScript problem getting page content with no fields

Certainly, but it is a heck of a lot easier if you can be sure that the browser you are using is more-or-less DOM1-compliant. That is, if you can use the following properties/methods:

.getElementsByTagName()

.childNodes

.parentNode

If you can use these methods (supported in IE5+, NS6+, Mozilla, Opera 6+, Safari, and all of the recent open-source browsers that I’m aware of) and can know the structure of the page, then you can get or set the information on the page. If the designer has been kind enough to include id attributes, then it gets even easier. Let’s assume that s/he didn’t, though, and that you want to change the style of the fourth cell in the second row of the third table to white text on a red background, then prompt the text it contains:

var allTables = document.getElementsByTagName(‘table’);

//gets all of the tables

var rowsInTableThree = allTables[2].getElementsByTagName(‘tr’);

//gets all rows in the third table – remember index is zero-based

var cellsInRowTwo = rowsInTableThree.getElementsByTagName(‘td’);

var cellFour = cellesInRowTwo[3];

cellFour.style.backgroundColor = ‘#ff0000’;

cellFour.style.color = ‘#ffffff’;

var kiddies = cellFour.childNodes();

var bigString = ‘’;

for (i=0;i<kiddies.length;i++) {

if(kiddies[i].type = 3) {

//3 is a text node

bigString += kiddies[i].data;

}

}

alert(bigString)

Subject: RE: JavaScript problem getting page content with no fields

Thanks a lot for your response Stan!I’m not that good at JavaScript, I can’t get your post to work for me…

I have an url: “http://myurl.com/page.html?type=get&pnr=” + EmployeeID

The body of the page looks like this:

pnr=1234567890;fnamn=Pia Elisabeth;ttnamn=Theres

Elisabeth;mnamn=;enamn=Andersson;coadr=;utdeladr1=;utdeladr2=GATAN

3;postnr=111111;postort=stad;land=;kylankod=1;kykomkod=78;fors=05;anhpnr=

;avrorsak= ;avrorsaktxt=;avrdatum=

What I want to do is get everything in between the body tags into a field, say by klicking a button.

The browser will be IE5+.

Thnks again for your help!

/Magdalena