JS implements the method of obtaining the clipboard content, and js implements the method of obtaining the clipboard content.

Source: Internet
Author: User

JS implements the method of obtaining the clipboard content, and js implements the method of obtaining the clipboard content.

This document describes how to obtain the clipboard content in JavaScript. We will share this with you for your reference. The details are as follows:

Here we introduce the code for JS to get the clipboard content:

<Script Language = "JavaScript"> var content = clipboardData. getData ("Text"); if (content! = Null) {document. write ("<center> <font size = 5 color = red> WARNING, text retrieved: </font> (see below) <br> <span style = 'background-color: # ffff00'> "); document. write (content); document. write ("</span>");} else {document. write ('<center> No text found in clipboard. this is a good thing! <Br> Works with Internet Explorer and Netscape. ') ;}</Script>
Var o = pos. parentElement (). parentNode; var txt = window. clipboardData. getData ("Text"); $ ('# tempforclip '). val (txt); var temp = $ ('# tempforclip '). val (); window. clipboardData. setData ("Text", temp );

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.