1、单击命令按钮时弹出新的小窗口的函数
function openNewImportPage()
{
//获取当前单位名称
var dunitcode=document.getElementById('<%= hid_dunitcode.ClientID %>').value;
……………………
……………………
var strSucode=document.getElementById('lblsSUCode').value;
var unitcode=document.getElementById('<%= hid_unitcode.ClientID %>').value;
//跳转到新的页面
var url="ch_ImportDetails.aspx?dunitcode="+dunitcode+"&ssucode="+ssucode+"&ssuname="+ssuname+"&unitcode="+unitcode;
OpenEditerWindow(url ,950,800);
}
function OpenEditerWindow(Url,Width,Height)
{
//打开新的窗口
var Top = parseInt((screen.availHeight - Height - 30) / 2);
var Left = parseInt((screen.availWidth - Width - 15));
window.open(Url,'','toolbar=0,location=0,maximize=1,directories=0,status=1,menubar=0,scrollbars=0,resizable=1,top=' + Top + ',left=' + Left + ',width=' + Width + ',height=' + Height);
}
2、cs中调用ScriptManager.RegisterStartupScript()方法ScriptManager.RegisterStartupScript(Page, this.GetType(), DateTime.Now.Ticks.ToString(), funcName + "();", true);
3、在Gridview的编辑模板中套用js实现,单击日历图片的时候,显示当前时间
<asp:TemplateField HeaderText="许可证截止时间" ItemStyle-VerticalAlign="Middle">
<ItemTemplate>
<input runat="server" type="text" class="nTxt" id="txt6" style="width:70"/>
<img src='/JScript/My97DatePicker/skin/datePicker.gif' width='16' height='22' alt='日历' οnclick='javascript:getEndDate();' />
</ItemTemplate>
</asp:TemplateField>