日期:2014-05-20  浏览次数:20547 次

★★★送分快来抢★★★:如何在后台代码中动态改变弹出页面的宽度?
★★★送分快来抢★★★:如何在后台代码中动态改变弹出页面的宽度?

------解决方案--------------------
写一个弹出页面的方法
------解决方案--------------------
强分地
------解决方案--------------------
<script>
function resz(wd,hg)
{
window.resizeTo(wd,hg);
}
</script>

<input type= "button " onclick= "javascript:resz(600,300); " value= "改变大小 " />
------解决方案--------------------
window.moveTo(0, 0);
window.resizeTo(screen.width, screen.height-20);

------解决方案--------------------
/// <param name= "opener "> 控件名称 </param>
/// <param name= "PagePath "> 弹出页面的路径 </param>
/// <param name= "WindowName "> 窗口名字 </param>
/// <param name= "width "> 宽度 </param>
/// <param name= "height "> 高度 </param>
public static void OpenPopUp(System.Web.UI.WebControls.WebControl opener,string PagePath,string WindowName,int width,int height)
{
string clientScript;
string windowAttribs;
windowAttribs= "width= " + width.ToString() + "px, "+ "height= "+height.ToString()+ "px, "+ "left= '+((screen.width - " + width.ToString() + ") / 4)+ ', "+ "top= '+ (screen.height - " + height.ToString() + ") / 4+ ' scrollbars=yes ";
clientScript = "window.open( ' " + PagePath + " ', ' " + WindowName + " ', ' " + windowAttribs + " ');return false; ";
opener.Attributes.Add( "onClick ", clientScript);
}
------解决方案--------------------
如果在客户端做,很容易. 如果一定要提交到后台再做的话,就存在一个问题. 页面提交后就无法与新窗口建立关系,除非这个页面存在于一个框架中,将这个新窗口的变量 保存在其他窗口中,再post回的时候可得到新窗口对象,然后进行resize操作.