一般我们经常碰到这样的场景,在页面需要包含别的页面,当然可以用include来包含进来,可是不太灵活,如果根据我们的需要加载页面,那不是更好吗,IFrame是个不错的选择:
首先你在页面需要包含的地方加上
<iframe name="IframeWidow" id="IframeWidow" frameborder="0" src="" style="border-style:solid;border-width:thin;display:none;position:absolute;"></iframe>
然后在js里面写个生成这个页面的方法
function IframeWidow_Open(sSrc,iWidth,iHeight,iTop,iLeft,sScrolling){
var oIframe=document.all("IframeWidow");
oIframe.onreadystatechange=onchangestatus;
oIframe.src=sSrc;
oIframe.style.width=iWidth;
oIframe.style.height=iHeight;
oIframe.style.zIndex=1;
var iframeTop;
var iframeLeft;
if ((iTop=="") || (iTop==null))
{
iframeTop=((document.body.clientHeight/2) - (parseInt(oIframe.style.height)/20))-0 ;
iframeTop=(iframeTop>0)?(iframeTop):(0);
}else{
iframeTop=iTop;
}
if ((iLeft=="") || (iLeft==null))
{
iframeLeft=((document.body.clientWidth/2) - (parseInt(oIframe.style.width)/2))-0;
iframeLeft=(iframeLeft>0)?(iframeTop):(0);
}else{
iframeLeft=iLeft;
}
oIframe.style.top=iframeTop;
oIframe.style.left=iframeLeft;
switch (sScrolling)
{
case "yes" :
oIframe.style.scrolling="yes";
break;
case "no" :
oIframe.style.scrolling="no";
break;
default :
oIframe.style.scrolling="auto";
break;
}
}
然后在没个时间里面设置好iframe的src调用即可
src可以是一个页面的url,也可以是
function showQuantityList(companyCode,partsCode,stockType,warehouseCode,warehouseLocationCode,warehouseType,ableUse_a_Qty,brand,articleNo,articleExtNo){
var urlstr='<html:rewrite page="/***Action.do?method=**&companyCode="/>'+companyCode+'&partsCode='+partsCode+'&warehouseCode='+warehouseCode+'&warehouseLocationCode='+warehouseLocationCode+'&stockType='+stockType+'&ableUse_a_Qty='+ableUse_a_Qty+'&brand='+brand+'&articleNo='+articleNo+'&articleExtNo='+articleExtNo+'&warehouseType='+warehouseType;
IframeWidow_Open(urlstr, 600, 450, 300, 200, 'auto');
}
首先你在页面需要包含的地方加上
<iframe name="IframeWidow" id="IframeWidow" frameborder="0" src="" style="border-style:solid;border-width:thin;display:none;position:absolute;"></iframe>
然后在js里面写个生成这个页面的方法
function IframeWidow_Open(sSrc,iWidth,iHeight,iTop,iLeft,sScrolling){
var oIframe=document.all("IframeWidow");
oIframe.onreadystatechange=onchangestatus;
oIframe.src=sSrc;
oIframe.style.width=iWidth;
oIframe.style.height=iHeight;
oIframe.style.zIndex=1;
var iframeTop;
var iframeLeft;
if ((iTop=="") || (iTop==null))
{
iframeTop=((document.body.clientHeight/2) - (parseInt(oIframe.style.height)/20))-0 ;
iframeTop=(iframeTop>0)?(iframeTop):(0);
}else{
iframeTop=iTop;
}
if ((iLeft=="") || (iLeft==null))
{
iframeLeft=((document.body.clientWidth/2) - (parseInt(oIframe.style.width)/2))-0;
iframeLeft=(iframeLeft>0)?(iframeTop):(0);
}else{
iframeLeft=iLeft;
}
oIframe.style.top=iframeTop;
oIframe.style.left=iframeLeft;
switch (sScrolling)
{
case "yes" :
oIframe.style.scrolling="yes";
break;
case "no" :
oIframe.style.scrolling="no";
break;
default :
oIframe.style.scrolling="auto";
break;
}
}
然后在没个时间里面设置好iframe的src调用即可
src可以是一个页面的url,也可以是
function showQuantityList(companyCode,partsCode,stockType,warehouseCode,warehouseLocationCode,warehouseType,ableUse_a_Qty,brand,articleNo,articleExtNo){
var urlstr='<html:rewrite page="/***Action.do?method=**&companyCode="/>'+companyCode+'&partsCode='+partsCode+'&warehouseCode='+warehouseCode+'&warehouseLocationCode='+warehouseLocationCode+'&stockType='+stockType+'&ableUse_a_Qty='+ableUse_a_Qty+'&brand='+brand+'&articleNo='+articleNo+'&articleExtNo='+articleExtNo+'&warehouseType='+warehouseType;
IframeWidow_Open(urlstr, 600, 450, 300, 200, 'auto');
}