Home > Web Front-end > HTML Tutorial > How to get the text of a web page element when it does not have an id/name/? _html/css_WEB-ITnose

How to get the text of a web page element when it does not have an id/name/? _html/css_WEB-ITnose

WBOY
Release: 2016-06-24 12:12:34
Original
1743 people have browsed it

(1) This is a checkbox

(2)"Player Regulations"

(3)100< /FONT>




These are the above three combined
(4) I agree and accept DNF "Player Regulations"(1 yuan = 100 DNF points)

For example, (3) I want to ask How to get the text without id/name/title? It is just "100" How about the text "100" here without id/name/title? Where to take it? ? Or how to rewrite its text? ?


Reply to discussion (solution)

<SPAN class=font_12 service="term"><INPUT id=rule onclick=change(); type=checkbox CHECKED value="" name=rule input> 本人同意并接受 <A href="http://dnf.qq.com/service/rules.htm" target=_blank>DNF《玩家条例》</A>(1元 = <FONT color=#ff6600>100</FONT> DNF点券)</SPAN><script>	var font = document.getElementsByTagName('font')[0];	alert( font.innerHTML )</script>	
Copy after login


What does the original poster mean?

HTML code

I agree and accept DNF...

I want to use my own program to change browsing The text in the browser window such as "100" changes the 100 here
but this html code does not have an id/name... Can it be changed? Others have id/names. . You can change the value of the text

Go check out the API yourself, jQuery's selector


What is the type of API that controls the web page called?
Go check out the API yourself, jQuery’s selector

I don’t understand what you are trying to say at all
http://www.css88.com/jqapi/index.html

I don’t understand what you want to say at all
http://www.css88.com/jqapi/index.html
This guy got it through the jquery plug-in. jquery implements it in a more comprehensive way. The methods I listed.

There are many ways to get DOM elements, such as through ID, through tags, through special attributes, through CSS classes, tracing parent elements through child elements, and traversing child elements through parent elements. The effect you want can be achieved in the following ways accomplish.

<script>    var font = document.getElementsByTagName('font')[0];    alert( font.innerHTML )</script>
Copy after login

It’s best to use jquery’s selector directly. It’s very simple

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template