这里是我的HTML代码:试图让一个搜索按钮,可以重定向到另一个网址,并复制剪贴板上的重定向URL
<input id="text" type="text" name="text">
<input type="button" name="page1" onclick="javascript:window.open('http://example.com/' + this.name + '/' + document.getElementById('text').value)">
如果你把在该领域的任何文本并单击该按钮它会重定向到http://example.com/page1/anytext
我试图让这个按钮能够重定向到URL并将其复制到剪贴板。因此,如果有任何访问者在该字段上输入anytext
,它将复制网址http://example.com/page1/anytext
并重定向到该网址。
的可能的复制[?如何复制JavaScript中的剪贴板(https://stackoverflow.com/questions/400212/how-do-i-copy-to -the-clipboard-in-javascript) – Ali