PDA

View Full Version : Getting text from another page


Lazaroth
01-29-2008, 07:12 PM
Hi, I wondered if it's possible to get text from one page and then put it on another page using DOM/javascript that's cross-browser.

Simplified example:

1. page1.htm

When a button is pressed, the text on page2.htm is read and printed onto page1.htm

2. page2.htm

Just plain text

Kor
01-29-2008, 07:53 PM
one solution could be on using
Ajax (http://en.wikipedia.org/wiki/AJAX)

A1ien51
01-29-2008, 08:01 PM
one solution could be on using
Ajax (http://en.wikipedia.org/wiki/AJAX)

Just to add a note....The pages have to be on the same domain for it to work.

Lazaroth
01-29-2008, 08:36 PM
Thanks! I'll look in to it!

Lazaroth
01-31-2008, 01:16 AM
Hi again.

I've studied Ajax and it's intriguing.

I have a new question tho:

Is there an easy way to get all href-info from "a":s from page 2 to 1?

Like:

1. page2.htm

<a href="http://www.site.com">The Site!</a>

2. page1.htm

http://www.site.com


I found a "dirty" solution (in my eyes) using RegExp, but is there an easy way?