以下內容属于 ‘JS’ 便签:

点击按钮 复制一个字段 如果用input 不要随意hidden

这里有段代码点击按钮 复制input中的内容,但是在项目中不太适合我。 于是我参考了:https://www.jianshu.com/p/13442dc61e06 12345678910111213141516171819202122    <textarea id="copy"></textarea>     <div class="wrap">       <p id="content">楼观岳阳尽,川迥洞庭开。雁引愁心去,山衔好月来。</p><br />       <button id="btn">拷贝</button>     </div>     <script type="text/javascript">       //处理按钮点击事件       var btn = document.getElementById('btn');       btn.onclick = function(){         //获取p节点的文本         […] (more...)

点击按钮实现复制指定文本

特别是做资源站,有提取码之类的字段 还是挺管用。分享给大家。 复制文本框中的文字 HTML代码部分 1234<div>      <input type="text" value="The Text to Copy" id="copyMe">      <button onclick="copyMyText()">复制到剪贴板</button> </div> JavaScript 部分 12345678910<script> function copyMyText() {      //select the element with the id "copyMe", must be a text box      var textToCopy = document.getElementById("copyMe");      //select the text in the text box   […] (more...)

根据访客的设备来显示视频的宽度和高度JS代码

有时候需要根据访客的设备来显示文章中的视频,现在用iPhone和iPad等的多了。下面是代码: (more...)