如何使此代码与所有浏览器兼容 [英] How do I make this code compatable with all the browsers
本文介绍了如何使此代码与所有浏览器兼容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
目前仅适用于Internet Explorer浏览器...
It Is currently Compatable Only with Internet Explorer Browser ...
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script type="text/javascript">
function copyToClipboard() {
var copyText = document.getElementById('txtCopyText');
if (!document.all) return;
copyTextRange = copyText.createTextRange();
copyTextRange.execCommand('copy');
alert('Copy To Clipboard : \n' + copyText.value);
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<input type="text" id="txtCopyText" value="hello" />
<input type="button" id="btnCopy" onclick="copyToClipboard()" value="Copy To ClipBoard" />
</div>
</form>
</body>
</html>
推荐答案
试试这个
< a href =http://ready2gosoft.com/jquery-javascript/copy-clipboard-javascript.html> jquery-javascript / copy-clipboard-javascript [ ^ ]
javascript-copy-to-clipboard [ ^ ]
Try this
jquery-javascript/copy-clipboard-javascript[^]
javascript-copy-to-clipboard[^]
这篇关于如何使此代码与所有浏览器兼容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文