<%@ Page Language="C#"  AutoEventWireup="true" CodeBehind="scantype_parameter.aspx.cs" Inherits="YXShop.Web.admin.templates.label.scantype_parameter" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>无标题页</title>
      <link href="../../style/admin.css" rel="stylesheet" type="text/css" />   
 <script language="javascript" type="text/javascript">
    function ReturnValue()
    {
      var TempletLayout;      
      var o=document.getElementsByName("rbl_TempletLayout");//布局方式
      var len=o.length;   
      for (var i=0;i<len ;i++ )       
       {
          if( o[i].checked==true )
          {
             TempletLayout=o[i].value;
           }
      }
      var ScanType;
      o=document.getElementsByName("rbl_scantype");  //浏览类别
      var len=o.length;
      for(var i=0;i<len;i++)
      {
        if(o[i].checked==true)
        {
           ScanType=o[i].value;
        }
      }
      var Number=document.getElementById("tb_namelength").value;
      var ShowRows = document.getElementById("Tb_rows").value;//显示行数
      var ShowColumns = document.getElementById("Tb_Columns").value;//显示列数
    var WhetherOmit;
    o=document.getElementsByName("rbl_WhetherOmit");//是否省略
    var len=o.length;   
    for (var i=0;i<len ;i++ )       
    {
        if( o[i].checked==true )
        {
            WhetherOmit=o[i].value;
        }
    }
       //自定义内容
        var mystyle = document.getElementById("txtLabelContent").value;
	
	var cnm ="[YX:Loop,YX:LableType=ScanType,YX:Option=Product,YX:ScanType="+ScanType+",YX:WhetherOmit="+WhetherOmit+",YX:ShowNumber="+Number+",YX:ShowRows="+ ShowRows+",YX:ShowColumns="+ShowColumns+",YX:TempletLayout="+TempletLayout+"]"+mystyle+"[/YX:Loop]";
	 
    parent.getValue(cnm);
	 CloseDiv();

}

function getValue(value)
    {
        var textObj=document.getElementById("txtLabelContent");
        var textFeildValue=value;
        if(value!="") 
        {
            if(document.all)
            {     
                if(textObj.createTextRange && textObj.caretPos)
                {   
                    var caretPos=textObj.caretPos;   
                    caretPos.text=caretPos.text.charAt(caretPos.text.length-1)==''?textFeildValue+'':textFeildValue;   
                }
                else
                {   
                    textObj.value=textFeildValue;   
                }   
            }
            else
            {   
                if(textObj.setSelectionRange)
                {   
                    var rangeStart =textObj.selectionStart;   
                    var rangeEnd=textObj.selectionEnd;   
                    var tempStr1=textObj.value.substring(0,rangeStart);   
                    var tempStr2 =textObj.value.substring(rangeEnd);   
                    textObj.value=tempStr1+textFeildValue+tempStr2;   
                }
                else
                {   
                    alert("This version of Mozilla based browser does not support setSelectionRange");   
                }   
            }
        }
    }
    function setCaret(textObj)
    {   
        if(textObj.createTextRange)
        {   
            textObj.caretPos=document.selection.createRange().duplicate();   
        }   
    } 
function CloseDiv()
{
    parent.document.getElementById("LabelDivid").style.display="none";
}


</script>

</head>
<body>
    <form id="form1" runat="server">
    <div>
    <table cellpadding="1" cellspacing="1"  style="width: 99%; margin-top:5px" class="form_table_input">
            <tr>
               <td>浏览商品记录类别</td>
               <td colspan="3">
                  <asp:RadioButtonList ID="rbl_scantype" runat="server" RepeatDirection="Horizontal" Height="24px">
                        <asp:ListItem Value="0" Selected="True">浏览该商品还浏览记录</asp:ListItem>
                        <asp:ListItem Value="1">购买该商品还浏览记录</asp:ListItem>
                    </asp:RadioButtonList>
               </td>
            </tr>
            <tr>
            <td>
               名称长度</td>
            <td>
                <asp:TextBox ID="tb_namelength" runat="server" Width="147px"  onkeyup="value=value.replace(/[^\d]/g,'') " 
                    onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))" >8</asp:TextBox>
            </td>
            <td>显示省略号</td>
            <td>
              
                <asp:RadioButtonList ID="rbl_WhetherOmit" runat="server" 
                    RepeatDirection="Horizontal">
                    <asp:ListItem Selected="True" Value="False">否</asp:ListItem>
                    <asp:ListItem Value="True">是</asp:ListItem>
                </asp:RadioButtonList>
            </td>
          </tr> 
            <tr>
                <td>
                   显示几行</td>
                <td>
                    <asp:TextBox ID="Tb_rows" runat="server" Width="147px"  onkeyup="value=value.replace(/[^\d]/g,'') " 
                        onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))" >2</asp:TextBox>
                </td>
                <td>
                    显示几列</td>
                <td>
                    <asp:TextBox ID="Tb_Columns" runat="server" Width="147px"  onkeyup="value=value.replace(/[^\d]/g,'') " 
                        onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))" >2</asp:TextBox>
                </td>
            </tr>
            <tr>
                <td>选择商品参数</td>
                <td>
                   <asp:DropDownList ID="ddl_Condtion" runat="server" Height="25px" Width="151px" 
                     onchange="javascript:getValue(this.value);">
                      <asp:ListItem Value="">--请选择显示信息--</asp:ListItem>
                       <asp:ListItem Value="[#Product_No]">商品货号</asp:ListItem>
                        <asp:ListItem Value="[#Product_Unit]">商品单位</asp:ListItem>
                        <asp:ListItem Value="[#Product_Name]">商品名称</asp:ListItem>
                            <asp:ListItem Value="[#Product_ShopPrice]">商品商城价</asp:ListItem>
                            <asp:ListItem Value="[#Product_MarketPrice]">商品市场价</asp:ListItem>
                            <asp:ListItem Value="[#Product_Thumbnails]>">商品缩略图</asp:ListItem>
                            <asp:ListItem Value="[#Product_Url]">超连接URL</asp:ListItem>                 
                    </asp:DropDownList>
                </td>
                 <td>
                    布局方式</td>
                <td>          
                    <asp:RadioButtonList ID="rbl_TempletLayout" runat="server" Height="26px" 
                        RepeatDirection="Horizontal" Width="116px">
                        <asp:ListItem Value="0" Selected="True">Div</asp:ListItem>
                        <asp:ListItem Value="1">Table</asp:ListItem>
                    </asp:RadioButtonList>
                </td>
            </tr>  
            <tr>
                
                <td colspan="4">
               <asp:TextBox runat="server" ID="txtLabelContent" height="100" onselect="setCaret(this);"  onclick="setCaret(this);"  onkeyup="setCaret(this);" Width="600" TextMode="MultiLine"></asp:TextBox>
               </td>
            </tr>
            
            <tr>
                <td colspan="4" align="center" style="text-align:center">
                   <input id="bt_Exc" type="button" value="提交" onclick="ReturnValue()" />
                    &nbsp;<input class="form" type="button" value=" 关 闭 "  onclick="javascript:CloseDiv();" /></td>
            </tr>
            </table>
    
    </div>
    </form>
</body>
</html>
