Javascript:

function docopy() {
        var target = document.getElementById("share-url");
        console.log(target.attributes)
        target.select();
        document.execCommand("copy");
    }


HTML:

<a href="javascript:docopy();" title="复制网址">复制网址</a>
	<input type="text" value="www.shuzp.top" id="share-url" />
Javascript: