想做页面美化特别是在一个页面中只占了很小一块的页面想做成弹出窗口样式稍微总结了下 通过重写<input标签下按钮的onclick事件来进行窗口的弹出设置 复制代码 代码如下: <input type="button" onclick="windowopen(/AddDpmentheight=width=fullscreen=noresizable=yesscrollbars=notop=left=)" value="添加部门"/> 其中windowopen(路径窗口的宽度高度相对窗体的位置是否全屏是否有滑动等属性设置); 通过重写<a herf=来获得窗口 复制代码 代码如下: <a href="" onclick="windowopen(<%=UrlAction("EditDpment""Admin"new{id = itemDepartment_id}) %>width=height=location=nomenubar=nostatus=noscrollbars=noresizable=no top=left=)">部门修改</a><br /> 其中由于MVC中路径的原因这里推荐使用<%=urlaction>来设置其路径这里可以通过urlaction中创建new{id}来传参数 可以通过jquery来定义并在控件中调用 弹出窗口后可以通过重新定义表单的地址和target属性来重新返回框架窗口中例如 复制代码 代码如下: <%using (HtmlBeginForm("EditGroup" "Admin" FormMethodPost new { target = "mainFrame" })) 这里是通过重写了beginform来实现的在解析后代码和普通<form表单提交的形式是一样的 如果想在提交表单后在关闭小窗口可以通过<input 中的onclick事件来控制使用javascript:selfclose();或者windowclose();来控制 |