stenphonechow

求一段点击复制的 js 代码,要兼容 iOS、安卓、和电脑版主流浏览器。

  •  
  •   stenphonechow · Jan 15, 2018 · 4275 views
    This topic created in 3221 days ago, the information mentioned may be changed or developed.
    目前的代码在 safari 和微信不能复制,其他浏览器表现良好。
    点击复制按钮后,复制的内容是: ${playInfo.videoUrl}
    求大神指点。

    <script type="text/javascript">
    function copyMyUrl()
    {
    var Url2=document.getElementById("biao1");
    Url2.select();
    document.execCommand("Copy");
    alert("复制成功");
    }
    </script>
    <textarea cols="20" rows="10" id="biao1">复制我</textarea>
    <input type="button" onClick="copyMyUrl()" value="点我复制" />
    9 replies  •  2018-01-16 00:41:53 +08:00
    stenphonechow
    stenphonechow
    OP
    Jan 15, 2018
    1
    在线等
    bubue
    bubue
    Jan 15, 2018
    2
    等楼下神人
    stenphonechow
    stenphonechow
    OP
    Jan 15, 2018
    4
    @b821025551b 谢谢
    SourceMan
    SourceMan
    Jan 15, 2018
    5
    苹果系不行
    stenphonechow
    stenphonechow
    OP
    Jan 15, 2018
    6
    @SourceMan HTML5 不是跨浏览器的吗?
    koor
    koor
    Jan 15, 2018
    7
    扒一扒前两天支付宝红包丧心病狂的推广页面
    g5
    g5
    Jan 15, 2018 via Android
    8
    不如直接说你打算强!奸你的用户剪切板
    dorentus
    dorentus
    Jan 16, 2018 via iPhone
    9
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   944 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 31ms · UTC 19:58 · PVG 03:58 · LAX 11:58 · JFK 14:58
    ♥ Do have faith in what you're doing.