日期:2014-05-18  浏览次数:20789 次

如何实现弹出网页
<!DOCTYPE   HTML   PUBLIC   "-//W3C//DTD   HTML   4.01   Transitional//EN ">

<HTML>
<HEAD>
<%@   page  
language= "java "
contentType= "text/html;   charset=GB18030 "
pageEncoding= "GB18030 "
%>
<META   http-equiv= "Content-Type "   content= "text/html;   charset=GB18030 ">
<META   name= "GENERATOR "   content= "IBM   WebSphere   Studio ">
<META   http-equiv= "Content-Style-Type "   content= "text/css ">
<LINK   href= "../theme/Master.css "   rel= "stylesheet "   type= "text/css ">
<TITLE> outmoth.jsp </TITLE>
<jsp:useBean   id= "xxtgtj "   class= "com.dbopt.Xxsjselect "   scope= "page "> </jsp:useBean>


<%
      xxtgtj.selecttg();
      int   sl=xxtgtj.getXxsl();
      System.out.println(sl);
%>


</HEAD>
<%
    System.out.println( "aa+ "+sl);
    if(sl==1)
    {
    out.println( " <BODY     onload= 'javascript:window.open( 'test.jsp ', '_blank '); '>     ");
      }
   
      if(sl> 1)
      {
  out.println( " <BODY     onload= 'javascript:window.open( 'inmoth.jsp ', '_blank '); '>     ");
   
      }else{
%>
<BODY     onload= "javascript:window.open( 'test.jsp ', '_blank '); ">            
<%
    }
%>
</BODY>
</HTML>

从数据库中得到值,如果是0,1,大于1的分别弹出不同的页面.
我做的这个不管得到什么值都弹出 'test.jsp '页面,不知道为什么?
谁有好的方法来解决,谢谢!

------解决方案--------------------
引号的问题,你把out.println( " <BODY onload= 'javascript:window.open( 'test.jsp ', '_blank '); '> "); onload后面的单引号去掉,改成
out.println( " <BODY onload=javascript:window.open( 'test.jsp ', '_blank ');> ");就ok拉