为了账号安全,请及时绑定邮箱和手机立即绑定

用jquery的id选择器的text()方法,取不到想要的字符串,怎么搞...

用jquery的id选择器的text()方法,取不到想要的字符串,怎么搞...

PHP
守候你守候我 2019-03-10 12:57:19
用jquery的id选择器的text()方法,取不到想要的字符串;试了一下用原生js也是一样的; 代码如下; <!doctype html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>Document</title> </head> <body id="body" style="display: none"> %0A%3C%21--%u6B64%u7F51%u9875%u5DF2%u52A0%u5BC6%uFF0C%u6B32%u89E3%u5BC6%u8BF7%u5230code.qcgzxw.cn/html.html%u89E3%u5BC6--%3E%0A%3Cform%3E%0A%20%20%20%20%3Ctr%3E%0A%20%20%20%20%20%20%20%20%3Ctd%3Edd%3C/td%3E%0A%20%20%20%20%20%20%20%20%3Ctd%3Eff%3C/td%3E%0A%20%20%20%20%20%20%20%20%3Ctd%3Ecc%3C/td%3E%0A%20%20%20%20%3C/tr%3E%0A%3C/form%3E%0A%3C%21--%u6B64%u7F51%u9875%u5DF2%u52A0%u5BC6%uFF0C%u6B32%u89E3%u5BC6%u8BF7%u5230code.qcgzxw.cn/html.html%u89E3%u5BC6--%3E%0A </body> </html> <script src="https://cdn.staticfile.org/jquery/3.3.1/jquery.min.js"></script> <script> /** * * @constructor */ function OutWord() { var Words = $("#body").text(); var NewWords; console.log(Words); NewWords = unescape(Words); console.log(NewWords); $("#body").html(NewWords).css("display", "block"); } OutWord(); </script> 为什么$("#body").text()会取到script标签里的东西? /** * * @constructor */ function OutWord() { var Words = $("#body").text(); var NewWords; alert(Words); console.log(Words); NewWords = unescape(Words); console.log(NewWords); $("#body").html(NewWords).css("display", "block"); } OutWord(); 这个是什么原理,之前没遇到过这种情况; 求助;
查看完整描述

4 回答

  • 4 回答
  • 0 关注
  • 555 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信