日期:2014-05-17  浏览次数:20684 次

带餐JS
提交到target_1.jsp后页面只显示
target_1.jsp
3 这句能显示啊
JS函数为什么进不去呢 求前辈 大侠 指教
HTML code

<?xml version="1.0" encoding="gb2312" ?>
<%@ page language="java" contentType="text/html; charset=gb2312"
    pageEncoding="gb2312"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>Insert title here</title>
</head>
<body>
    <form action="target_1.jsp" method="post">
        <input type="text" name="text1" />
        <input type="submit" name="submit" value="提交"/>    
    </form>
</body>
</html>


HTML code

<?xml version="1.0" encoding="gb2312" ?>
<%@ page language="java" contentType="text/html; charset=gb2312"
    pageEncoding="gb2312"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>Insert title here</title>
<%
    String str = (String)request.getParameter("text1");
%>
<script type="text/javascript">
function modifyPwd(obj) {
    alert("++++++");
    //if(obj.equals("3")){
    if(obj==3){
        alert("++++++");
    }else{
        alert("------");
    }
}
</script>
</head>
<body>
target_1.jsp<br/><%=str %>
<% if(str!=null&&(str.equals("3")||str.equals("4"))){%>
  这句能显示啊
    <script type="text/javascript">
        modifyPwd(str);
    </script>
<%} %>
</body>
</html>



------解决方案--------------------
应该是modifyPwd("<%=str%>")