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

jsp中js代码没有执行. 不知道原因
<script type="text/javascript">
alert("a");
fuction show(){
<%
IProDAO dao = new ProDAOImpl();
String strId = request.getParameter("id"); 
int tid = strId!=null?Integer.parseInt(strId):1;
Product p = dao.getProductById(tid);
int id = p.getId();String name = p.getName();
String guige = p.getGuiGe();int num = p.getNum();
double price = p.getPrice(); 
String factory = p.getFactory();
%>
alert("name");
document.getElementById("name").value = <%=name%>
document.getElementById("guige")value = <%=guige%>
document.getElementById("num")value = <%=num%>
document.getElementById("factory").value = <%=factory%>
}
  </script>


  <body onload="show()">
  在jsp里面 没有给文本框赋值

  重写URL时候 <a href = "update.jsp?id="+<%=p.getId() %>> 在那边页面没有接受到值得...也不知道为什么 


------解决方案--------------------
探讨
拼写错误:

fuction show(){
修改为
function show(){