Home >Web Front-end >HTML Tutorial >How to get the value of Chinese text in hyperlink_html/css_WEB-ITnose

How to get the value of Chinese text in hyperlink_html/css_WEB-ITnose

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-24 12:09:47925browse

5c2797f5f460d709775ffb3fc6183472China5db79b134e9f6b82c0b36e0489ee08ed
How to take out the value of "China" and pass it as a parameter to login.jsp


Reply to the discussion (solution)

Use the InnerText attribute to extract using Javascript. It is best to set an ID so that you can get the 3499910bf9dac5ae3c52d5ede7383485 tag element you want to get the value through GetElementById.

<a href="login.jsp">中国</a><script type="text/javascript">document.getElementsByTagName('a')[0].onclick = function() {	this.href += '?country=' + encodeURIComponent(this.innerHTML);}</script>

HTML code

5c2797f5f460d709775ffb3fc6183472China5db79b134e9f6b82c0b36e0489ee08ed
2840a3de185fface63704a94c15e7273
document.getElementsByTagName('a')[0].onclick = function() {
this.href = '?country=' encodeURIComponent(this.innerHTML...

Use the InnerText attribute and use Javascript to extract it. It is best to set an ID so that you can get the 3499910bf9dac5ae3c52d5ede7383485 tag element you want to get the value through GetElementById. Not all browsers support innerText, and your size. Pay attention when writing

5c2797f5f460d709775ffb3fc6183472China5db79b134e9f6b82c0b36e0489ee08ed
Take out the word "China" and assign it to contry and pass it to login.
Please send me the specific code in jsp. Thank you!

5c2797f5f460d709775ffb3fc6183472China5db79b134e9f6b82c0b36e0489ee08ed
Take the word "China" Come out and assign it to contry and pass it to login.jsp
Send the specific code, urgently needed! Thank you,

HTML code
5c2797f5f460d709775ffb3fc6183472China< ;/a>
4ec11beb6c39d0703d1751d203c17053
document.getElementsByTagName('a')[0].onclick = function() {
this.href = '?country =' encodeURIComponent(this.innerHTML);
}...
But it’s better to add an id and use it to get it.

encodeURIComponent(this.innerHTML)

< ;a href="login.jsp">China5db79b134e9f6b82c0b36e0489ee08ed
Take out the word "China" and assign it to contry and pass it to login.jsp
Send the specific code. Urgent need! Thank you,
Others have already provided you with the method. . Write it yourself. . Is it you who gets the salary or someone else? .

Statement:
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