[英]how do i parse the username from the page source code?
I will be running the javascript through my browser (chrome) like this javascript:
codegoeshere, so i cannot use jQuery
. 我将通过我的浏览器(chrome)像这样的
javascript:
codegoeshere来运行javascript,因此我无法使用jQuery
。 The website is not mine, so i cannot modify it. 该网站不是我的,所以我无法对其进行修改。 In the source code of the web page the username is stored like this:
在网页的源代码中,用户名的存储方式如下:
<div class="m-names"><div class="m-h3"><strong>@usernamegoeshere</strong>
My question is, how can i parse @usernamegoeshere
with javascript
into a variable? 我的问题是,我如何使用
javascript
将@usernamegoeshere
解析为变量? I want to be able to alert the final result. 我希望能够提醒最终结果。 Thanks to anyone that can help.
感谢任何可以提供帮助的人。
只需使用querySelectorAll
javascript:alert(document.querySelectorAll(".m-names .m-h3 strong")[0].innerHTML);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.