为什么我的一个Action,在普通页面执行没问题,在window.showModalDialog中就不执行呢?具体代码如下:
在1.jsp中这样写
if(type=='1'){
window.showModalDialog("TzglAction.do? operate=searchHzjh&operPage=tzgl_jh&tzgl.tz_no="+id,"",'dialogWidth:620px;dialogHeight:550px;status:no');
}
在2.jsp中这样写
<td align="center">
<a href="javascript:doJHZT('<bean:write name='e' property='jh_rec_id' />');" >
<font color="blue"> <bean:write name="e" property="jh_title" /></font>
</a>
</td>
function doJHZT(id)
{
alert(id);
if (id==null) {return;}
window.showModalDialog("TzglAction.do?operate=viewJhzt&operPage=sjhzhk_jhzt&dzjh.JH_REC_ID="+id,"",'dialogWidth:620px;dialogHeight:520px;status:no');
}
这样不执行如果是在1.jsp中这样写:
if(type=='1'){
TzglForm.action="TzglAction.do?operate=searchHzjh&operPage=tzgl_jh&tzgl.tz_no="+id ;
TzglForm.submit();
}
在2.jsp中不变,那就可以执行了
在1.jsp中这样写
if(type=='1'){
window.showModalDialog("TzglAction.do? operate=searchHzjh&operPage=tzgl_jh&tzgl.tz_no="+id,"",'dialogWidth:620px;dialogHeight:550px;status:no');
}
在2.jsp中这样写
<td align="center">
<a href="javascript:doJHZT('<bean:write name='e' property='jh_rec_id' />');" >
<font color="blue"> <bean:write name="e" property="jh_title" /></font>
</a>
</td>
function doJHZT(id)
{
alert(id);
if (id==null) {return;}
window.showModalDialog("TzglAction.do?operate=viewJhzt&operPage=sjhzhk_jhzt&dzjh.JH_REC_ID="+id,"",'dialogWidth:620px;dialogHeight:520px;status:no');
}
这样不执行如果是在1.jsp中这样写:
if(type=='1'){
TzglForm.action="TzglAction.do?operate=searchHzjh&operPage=tzgl_jh&tzgl.tz_no="+id ;
TzglForm.submit();
}
在2.jsp中不变,那就可以执行了
原来是模态窗口的一个bug,
模态窗口内部有弹出窗口的链接,最好用onclick事件来触发JS事件(避免使用a href='javascript:xxx();')