dimanche 4 décembre 2016

How to copy URL on button click?

I am trying to copy URL on button click. Some how i have tried but is not working. http://ift.tt/2gUI5eL

<html>
<head>
<title></title>
</head>
<script type="text/javascript">
        function Copy() 
        {
            var Url = document.createElement("textarea");
            Url.innerHTML = window.location.href;
            Copied = Url.createTextRange();
            Copied.execCommand("Copy");
        }
</script>
<body>
   <div>
    <input type="button" value="Copy Url" onclick="Copy();" />
    <br />
    Paste: <textarea rows="1" cols="30"></textarea>
   </div>
</body>
</html>




Aucun commentaire:

Enregistrer un commentaire