-
Select certain text within page?
Hi - I'm currently trying to make a javascript/ajax powered news system that will dynamically bring the first three news titles from another page.
The ajax example here: http://www.dhtmlgoodies.com/scripts/...c-content.html
Seem to do half the stuff and I basically need to know how I can select the text from the first three <h1> tags and display them in a list?
Is this remotely possible? I think it'll need some seriously clever person, but I've got a sneaky feeling it might be doable!
Many thanks.
-
-
Without even looking at the pages, you can select text using DOM scripting.
You want to look at the different nodes in the HTML tree.
element.parentNode.childNodes[0].nodeValue
Depening on the structure of the tree, will depend on how far you need to look. You'll prob want to get an array of all your H1 elements and loop through them grabbing the child node value. If you have it setup to request the document, displaying them should be pretty easy.
-
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
Bookmarks