我无法复制代码内的整个Cookie区域。

huangapple go评论60阅读模式
英文:

I can't copy the entire cookie area inside the code

问题

抱歉,我无法执行代码。以下是您提供的文本的翻译部分:

"Friends,

I'm creating a website with a page builder, and I share some cookies on it.

I tried to create this code so that users can more easily copy and paste the cookie.

However, I can only copy the first few characters of the cookie.

Look at the pictures, I don't know where I'm going wrong.

Sorry, I'm new to this area.

enter image description here

i want to be able to copy all the cookie

I want to be able to copy the entire cookie, not just those first few characters."

英文:

Friends,

I'm creating a website with a page builder, and I share some cookies on it.

I tried to create this code so that users can more easily copy and paste the cookie.

However, I can only copy the first few characters of the cookie.

Look at the pictures, I don't know where I'm going wrong.

Sorry, I'm new to this area.

  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <link rel="stylesheet" href="footer.css" />
    <title>Javascript - Copy to Clipboard</title>

  </head>
  <body>
    <input
      type="text"
      name="texto"
      id="texto"
      readonly
      placeholder="Digite alguma coisa"
      value=`
    "[
    {
        
    {
           [    {        
        "domain": "teste.pro",
        "hostOnly": true,
        "httpOnly": false,
        "name": "wordpress_test_cookie",
        "path": "/",
        "sameSite": null,
        "secure": false,
        "session": true,
        "storeId": null,
        "value": "WP%20Cookie%20check"
    },
    {
        "domain": "teste.pro",
        "expirationDate": 1708729370.70298,
        "hostOnly": true,
        "httpOnly": false,
        "name": "wp-settings-time-1",
        "path": "/",
        "sameSite": null,
        "secure": true,
        "session": false,
        "storeId": null,
        "value": "1677193564"
    }
]
 "
   ` />
    <button onclick="copiarTexto()">Copiar</button>

    <script>
      function copiarTexto() {
        let textoCopiado = document.getElementById("texto");
        textoCopiado.select();
        textoCopiado.setSelectionRange(0, 99999);
        document.execCommand("copy");
        alert("O texto é: " + textoCopiado.value);
      }
    </script>

    <div class="footer" id="footer"></div>
    <script src="footer.js"></script>
  </body>
</html>

enter image description here

i want to be able to copy all the cookie

I want to be able to copy the entire cookie, not just those first few characters.

答案1

得分: 1

谢谢大家的关注,问题很简单,我加上了单引号,然后它正常工作了。

英文:

Thank you all for your attention, the problem was simple, I put the single quotes and it worked normally.

答案2

得分: 0

从外部位置提取"value="的任何方法吗?例如。

我有一个存储在OneDrive中的txt文本,我想从该文本中提取"value"的信息。

英文:

Is there any way to extract the "value=" from another external location? For example.

I have a text in OneDrive in txt, I want the "value" to extract the information from that text.

    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <link rel="stylesheet" href="footer.css" />
    <title>Javascript - Copy to Clipboard</title>

  </head>
  <body>
    <input
      type="text"
      name="texto"
      id="texto"
      readonly
      placeholder="Digite alguma coisa"
      value=""

    <button onclick="copiarTexto()">Copiar</button>

    <script>
      function copiarTexto() {
        let textoCopiado = document.getElementById("texto");
        textoCopiado.select();
        textoCopiado.setSelectionRange(0, 99999);
        document.execCommand("copy");
        alert("O texto é: " + textoCopiado.value);
      }
    </script>

    <div class="footer" id="footer"></div>
    <script src="footer.js"></script>
  </body>
</html>

huangapple
  • 本文由 发表于 2023年2月24日 08:43:18
  • 转载请务必保留本文链接:https://go.coder-hub.com/75551672.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定