<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>点击复制</title>
</head>
<body>
推荐码 : <span id="copy-text">123456</span>
<a href="javascript:;" onclick="copyToClipboard('copy-text')" class="copy-btn">点击复制</a>
<script type="text/javascript">
function copyToClipboard(elementId) {
var aux = document.createElement("input");
var content = document.getElementById(elementId).innerHTML || document.getElementById(elementId).value;
aux.setAttribute("value", content);
document.body.appendChild(aux);
aux.select();
document.execCommand("copy");
document.body.removeChild(aux);
console.log('复制成功!直接粘贴即可');
}
</script>
</body>
</html> <!DOCTYPE html> <html> <head> <title>捕捉和冒泡</title> <meta charset="utf-8"> </head> <bo...
<!DOCTYPE html> <html> <head> <title></title> <meta charset="utf-8"> </head> <body>...
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title></title> </head> <body>...
jQuery 插件——jqueryrotate,它可以实现旋转效果。jqueryrotate 支持所有主流浏览器,包括 IE6。如果提示方法不存在,可能是你的Jquery版本过低或者过高。基本语法:$('#img').rotate(90);//旋转90度其他的参数:参数类型说明默认值...
//构造函数 function Box(name,age){ this.name=name; this.age=age; this.run=function(){ return this.name+'--'+this.age; } } var&nbs...
//原型的缺点 function Box(){} Box.prototype={ 'name':'gao', age:23, family:['哥哥','姐姐','妹妹'], &...