•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the JavaScript / DHTML / AJAX section within the Web Development category of DaniWeb, a massive community of 392,054 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 4,290 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting
Views: 896 | Replies: 4 | Solved
![]() |
•
•
Join Date: Jun 2008
Posts: 10
Reputation:
Rep Power: 1
Solved Threads: 1
I'm trying to get some HTML code from a page. The only way to do this that I know of is
But the problem is that the page is taken from the web and it has no IDs to get and I can't modify it by putting IDs.
So is there a way to get the innerHTML of the whole page so I can search for certain strings afterwards?
javascript Syntax (Toggle Plain Text)
document.getElementById('id').innerHTML = 'newhtml';
So is there a way to get the innerHTML of the whole page so I can search for certain strings afterwards?
•
•
Join Date: Jan 2006
Posts: 13
Reputation:
Rep Power: 3
Solved Threads: 1
Hi, SirDorius.
Instead of using You could use
This method will give you an array of all the elements on the page with that tag name. Just access each tag like you would access an array.
For example, if you wanted to get the inner HTML of the third division on the page you could use:
Hope that helps,
Adam
Instead of using
javascript Syntax (Toggle Plain Text)
document.getElementById(id).innerHTML;
javascript Syntax (Toggle Plain Text)
document.getElementsByTagName(tag)[0].innerHTML;
This method will give you an array of all the elements on the page with that tag name. Just access each tag like you would access an array.
For example, if you wanted to get the inner HTML of the third division on the page you could use:
javascript Syntax (Toggle Plain Text)
document.getElementsByTagName("div")[2].innerHTML;
Hope that helps,
Adam
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb JavaScript / DHTML / AJAX Marketplace
Similar Threads
- Custom page to login to Yahoo, Gmail, MSN etc (JavaScript / DHTML / AJAX)
- Dual use of <asp:TextBox in ASP.NET page (JavaScript / DHTML / AJAX)
- Javascript causes page to crash (JavaScript / DHTML / AJAX)
- This ASP.NET page is not working...!!! SOS (ASP.NET)
- How to get the link that was clicked even after the page gets refreshed (JSP)
- How to get the link that was clicked even after the page gets refreshed (JavaScript / DHTML / AJAX)
- update the page without changing it? (Site Layout and Usability)
- Retrieving values from pop up and displaying into asp page (ASP)
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: timescript- page redirection
- Next Thread: how to run javascript program


Linear Mode