Javascript window.open("")带参数传值跳另新页面

//脚本部分
function showQuery(type)
{
    var sDate=document.getElementById("DatePicker1").value;//获取开始时间
    var eDate=document.getElementById("DatePicker2").value;//获取结束时间
    if(type=='sc')//判断是否为简体中文(sc)传值
    {
        var str1="HistoryQuery.aspx?scode=601628&scodetype=a&lg=sc&startDate="+sDate+"&endDate="+eDate+"";
        window.open(str1);
    }
    if(type=='tc')//判断是否为繁体中文(tc)传值
    {
        var str2="HistoryQuery.aspx?scode=601628&scodetype=a&lg=tc&startDate="+sDate+"&endDate="+eDate+"";
        //window.open('HistoryQuery.aspx?scode=601628&scodetype=a&lg=tc&startDate="+ sDate +"&endDate="+ eDate +"');//试过这种传值通不过
        window.open(str2);
    }
}
//html部分
<body>
  <form id="Form1" method="post" runat="server">
    <asp:TextBox ID="DatePicker1" runat="server" Width="100px" onfocus="calendar();"></asp:TextBox>/注这里用到calendar.js时间控件
    <asp:TextBox ID="DatePicker2"  runat="server" Width="100px" onfocus="calendar();"></asp:TextBox>
    <input id="Button1" type="button" value="查詢"  class="ButtonCss" style="width: 44px" onclick="showQuery('tc')"/>
  </form>
<body>

你可能感兴趣的:(window.open)