在指定位置插入内容 JS



/// <reference path="../../../script/jquery-1.11.0.js" />
$(document).ready(function () {
    var _detail1 = $("#detail1");
    $(_detail1).on('dblclick', "button", function () {
        var _self = $(this);
        $("#textcontent").insertAtCaret("{@" + _self.attr("headtext") + "}");
    });
    $("#Save").click(function ()
    {
        SaveData();
    });
});

function SaveData() {
    var strJson = "{ ";//
    strJson += "\"keyvalue\":\"" + $("#keyvalue").val() + "\",";
    strJson += "\"data\":\"" + $("#textcontent").val() + "\""; 
    strJson += "}";
    alert(strJson);
    var sendJson = eval("(" + strJson + ")");
    // alert(JSON.stringify(sendJson));
    alert(21);
}
(function ($) {
    $.fn.extend({
        insertAtCaret: function (myValue) {
            var $t = $(this)[0];
            if (document.selection) {
                this.focus();
                sel = document.selection.createRange();
                sel.text = myValue;
                this.focus();
            }
            else
                if ($t.selectionStart || $t.selectionStart == '0') {
                    var startPos = $t.selectionStart;
                    var endPos = $t.selectionEnd;
                    var scrollTop = $t.scrollTop;
                    $t.value = $t.value.substring(0, startPos) + myValue + $t.value.substring(endPos, $t.value.length);
                    this.focus();
                    $t.selectionStart = startPos + myValue.length;
                    $t.selectionEnd = startPos + myValue.length;
                    $t.scrollTop = scrollTop;
                }
                else {
                    this.value += myValue;
                    this.focus();
                }
        }
    })
})(jQuery);
function getQueryString(name) {
    var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
    var r = window.location.search.substr(1).match(reg);

    if (r != null) {
        return unescape(r[2]);
    }
    return null;
};






<%@ Page Language="C#" AutoEventWireup="true" CodeFile="SetSMSContent.aspx.cs" Inherits="app_sms_sendmap_SetSMSContent" %>

<%--<!DOCTYPE html>--%>
<%@ Register Src="~/controls/FloatTitle.ascx" TagPrefix="uc1" TagName="FloatTitle" %>
<%@ Register Src="~/controls/Msg.ascx" TagPrefix="uc1" TagName="Msg" %>
<%@ Register Src="~/controls/FloatFrame.ascx" TagPrefix="uc1" TagName="FloatFrame" %>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title></title>
   <script type="text/javascript" src="../../../script/jquery-1.11.0.js"></script>
    <script type="text/javascript" src="SetSMSContent.js"></script>
    <style type="text/css">
          button {
            margin-right: 4px;
              margin-bottom: 3px;
        }
          div a{float:left}
    </style>
</head>
<body style="margin: 0; padding: 0; height: 100%; overflow: auto;">
    <div style="width: 100%; height: 100%;">
         
        <table style="height: 100%; width: 100%; margin: 0; padding: 0; border: 0;">
            <tr>
                <td>
                    <div id="template" style="width: 100%; align-content: center; background: #ffffff; height: 100%;">
                     

                        <div id="header0" style="height: 26px; overflow: auto; background-color: #cccccc;">
                           <%-- <span style="height:22px; vertical-align:central;">请选择模板类型:</span>
                            <select id="tmptype" style="height:22px; vertical-align:central;  align-content:center; margin-right:8px;">
                                <option value="Order" title="订单">订单</option>
                                   <option value="Delivery" title="发货单">发货单</option>
                            </select>--%>
                            <a id="Save"  style=" color:blue; cursor:pointer;">保存</a>

                             <a id="Close"  style=" color:blue; cursor:pointer; float:right;" οnclick="parent._HideFloatFrame()">关闭</a>
                        </div>

                        <div id="detail0" style="height: 85%;">
                            <textarea id="textcontent" style="height: 100%; width: 100%; overflow: auto;" rows="30" cols="1"></textarea>
                        </div>
                    </div>
                </td>
                <td style="background-color: lightblue; width: 12px"></td>
                <td style="width: 350px; height: 100%; overflow: auto; vertical-align: top;">
                    <input type="hidden" id="keyvalue" />
                    <div style="height: 100%; overflow: auto;">
                          <div style='background-color: #cccccc; height: 20px; margin-bottom: 4px;'>
                              配置数据
                            </div>
                       <div id="detail1" style="height: 200px; margin-top: 4px;">
                            <button class='21' value='{@OrderId}' headtext="订单号">订单号</button>
                              <button class='21' value='{@OrderId}' headtext="出库单">出库单</button>
                           <button class='21' value='{@OrderId}' headtext="用户名称">用户名称</button>
                        </div>
                    </div>
                </td>

            </tr>
        </table>
    </div>
</body>
</html>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值