js的一些零碎知识积累

来源:互联网 发布:直播间送礼物 知乎 编辑:程序博客网 时间:2024/05/01 17:46

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='日历' onclick='javascript:getEndDate();' />  </ItemTemplate></asp:TemplateField>


原创粉丝点击