zoukankan      html  css  js  c++  java
  • 拼接字符串克隆

    <!doctype html>
    <html>
        <head>
            <!--声明当前页面的编码集:charset=gbk,gb2312(中文编码),utf-8国际编码-->
            <meta http-equiv="Content-Type" content="text/html; charset=gbk">
            <script type="text/javascript" src=""></script><!--引入的js  src是引入的js样式路径-->
            <link rel="stylesheet" href="" /><!--引入的css页面的样式 href是引入的css样式路径-->
            <!--当前页面的三要素-->
            <title>字符串拼接</title>
            <meta name="Keywords" content="关键词,关键词">
            <meta name="description" content="">
            <!--css,js-->
            <style type="text/css">
                *{margin:0;padding:0;font-family:"微乳雅黑";font-size:14px;}
                body{background:#2D2D2D;}
                input{color:#fff}
                .w_cont .w_neirong{80%;height:250px;background:#fff;margin:10px auto;border-radius:10px;}
                .w_cont .w_retuse{80%;height:250px;background:#fff;margin:0 auto;margin-top:-25px;border-radius:10px;}
                input{background:#308796;border:1px solid #308796;border-radius:5px;100px;height:35px;}
                p{margin:30px auto;text-align:center;color:#fff;}
                textarea{border:3px solid #6A6A6A;100%;height:250px;border-radius:10px;padding:10px;}
            </style>
        </head>
    <body style="100%;height:100%">
    <div class="w_cont">
        <div class="w_neirong" id="w_neirong">
            <textarea class="w_target" id="target"></textarea>
        </div>
        <p>
            <input type="button" value="转双引号" onclick="shunyinghao()"/>
            <input type="button" value="转双引号为一行" onclick="wfshunyinghao()"/>
        <p>
        <div class="w_retuse" id="w_retuse">
            <textarea class="w_result" id="result"></textarea>
        </div>
    </div>
    <script>
    function dom(id){
       return document.getElementById(id);
    }
    //转多行
    function shunyinghao(){
        var value =dom("target").value;
            value=value.replace(/"/g, "'");
        var s = value.split(" "),
            len = s.length;
        for (var i = 1; i <= len; i++) {
            if ("" != s[i - 1]) {
                s[i - 1] = "str+="" + s[i - 1]+"";";
            }
        }
        dom("result").value = s.join(" ");
        }
    //转一行
    function wfshunyinghao(){
        var value =dom("target").value;
            value="str+="" + value.replace(/"/g, "'").replace(/s/g, "")+"";";
            dom("result").value =value;
    }
    </script>
    </body>
    </html>

  • 相关阅读:
    Are You Safer With Firefox?(zz)
    IIS+PHP下调用WebService初试
    垃圾链接和网络欺骗
    微软即将发布64位XP和Win2003 SP1(zz)
    今日个人大事记:)
    GT4 Web Service编译和发布初探
    纪念一下QQ等级和在线时长
    今天安装GT3.9.5碰到的问题
    判断32位整数二进制中1的个数
    Windows 2003 SP1新体验
  • 原文地址:https://www.cnblogs.com/dreamwf/p/5728004.html
Copyright © 2011-2022 走看看