JS实现 分享视频中-->点击button(copy),复制对应网址
2015-07-10 10:58
716 查看
分享视频中-->点击button(copy),复制对应网址
HTML页面代码<input type="text" class="share-input" value="http://www.youtube.com" id="copy-content"/>
<button class="copy-button" type="button" onclick="copyContent();"> Copy </button>
<p> Embed </p>
<input type="text" class="share-input" value="http://www.vimeo.com" id="copy-embed"/>
<button class="copy-button" type="button" onclick="copyEmbed();"> Copy </button>
JS代码
/*Copy function implementation */
function copyContent(){
var copyobject=document.getElementById("copy-content");
copyobject.select();
document.execCommand("Copy");
alert("has been copied you can paste");
};
function copyEmbed(){
var copyobject=document.getElementById("copy-embed");
copyobject.select();
document.execCommand("Copy");
alert("has been copied you can paste");
};
效果图
页面效果图
点击Copy按钮
相关文章推荐
- 数据可视化 d3js学习之简单的饼图
- 深入了解jsonp解决跨域访问
- js 中json字符串转化json对象
- FastJson的使用
- 原生js 异步请求,responseXML解析
- 移动设备、手机浏览器Javascript滑动事件代码
- JSP内置对象与servlet对应关系
- 不要使用SBJSON(json-framework)
- js 网页各种定位
- JavaScript数据类型转换
- JSVM代码阅读笔记
- JavaScript中的execCommand()命令详解及实例展示
- JSVM中配置文件介绍以及如何配出各种可分级
- JSP自定义标签开发入门
- MyEclipse/Eclipse 修改jsp XML java HTML 每行代码长度限制
- Servlet以及jsp异常的处理
- JSP四种注释方法及相关注意事项
- 2015.7.10js-07(简单时间)
- json串的解析格式
- js中判断json是否为空