Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7031799
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T00:51:02+00:00 2026-05-28T00:51:02+00:00

I want to access particular bits of text on a website, using a javascript

  • 0

I want to access particular bits of text on a website, using a javascript injection.

Going through the HTML however, i find that most of it is lacking Id’s, and so i do not know how to access the text.

For example, two lines of the HTML are the following:

<td valign="top" width="100%" >
<h1>My example heading</h1>

Would there still be any way of finding out what this text says?

Also, if DO know what that text says, is there any way of finding out the following bit of text…

<td valign="top" width="100%" >
<h1>You are trying to work out:</h1>
<h1>This text</h1>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T00:51:03+00:00Added an answer on May 28, 2026 at 12:51 am

    Oh, that’s not too bad at all. You’ll want to do something like this:

    var els = document.getElementsByTagName("td");
    var text1 = "";
    var text2 = "";
    for (var i = 0; i < els.length; i++) {
        if (els[i].width == "100%" && els[i].getAttribute("valign") == "top") {
            var h1s = els[i].getElementsByTagName("h1");
            if (h1s.length > 0) text1 = h1s[0].innerHTML;
            if (h1s.length > 1) text2 = h1s[1].innerHTML;
        }
    }
    

    Now, if there were lots of tables, you might need to replace the first line with this:

    var els = document.getElementsByTagName("table")[2].getElementsByTagName("tr")[4].getElementsByTagName("td");
    

    Read that as: Get table elements, select the third one. Get all of that table’s rows, select the fifth one. Get all that row’s cells. Look for any ones with 100% width and valigned top, and see if they’ve got h1’s.

    fiddle: http://jsfiddle.net/JUK5R/26/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to access a MySQL database directly from JavaScript code in an HTML
I want to access text of particular line in a multi-line TextView. Any suggestions
I want to access MySQL through ruby on a shared linux server. I figure
I want to access a repository using both GIT and SVN clients. A way
I want to access the clipboard using Python 3.1. I've obviously come across win32clipboard,
I want to access all of the message text body so I can store
I want to block access of my site from one particular IP address, how
Using Access VBA, I want to open an XL file, do stuff, then close
I want to get PrintScreen of Client PC when he access a particular Web
I have some shared preferences (latitude, longitude) that I want to access from a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.