矿泉水wz 发表于 2007-11-8 15:28

Myeclipse软件中的jsp问题!

<P><BR>Myeclipse软件中的jsp问题!</P>
<P>请教高手:::::::::::::::::::<BR>用Myeclipse软件中的jsp,jsp中的&lt;form&gt;标签为什么不能给name属性?(给就会错)<BR>如果我想在同页面的"脚本"中得到&lt;form&gt;中的值,应该怎样得到?<BR></P>

netstriker 发表于 2007-11-8 15:38

<P>  用dom来做 <BR>    <BR>  &lt;%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%&gt;<BR>&lt;%<BR>String path = request.getContextPath();<BR>String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";<BR>%&gt;</P>
<P>&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"&gt;<BR>&lt;html&gt;<BR>  &lt;head&gt;<BR>    &lt;base href="&lt;%=basePath%&gt;"&gt;<BR>    <BR>    &lt;title&gt;My JSP 'test.jsp' starting page&lt;/title&gt;<BR>    <BR>    &lt;meta http-equiv="pragma" content="no-cache"&gt;<BR>    &lt;meta http-equiv="cache-control" content="no-cache"&gt;<BR>    &lt;meta http-equiv="expires" content="0"&gt;    <BR>    &lt;meta http-equiv="keywords" content="keyword1,keyword2,keyword3"&gt;<BR>    &lt;meta http-equiv="description" content="This is my page"&gt;<BR>    &lt;!--<BR>    &lt;link rel="stylesheet" type="text/css" href="styles.css"&gt;<BR>    --&gt;<BR>    &lt;script type="text/javascript"&gt;<BR>        function get()<BR>        {<BR>            var form = document.getElementById("myform");<BR>            alert(form.name);<BR>        }<BR>    &lt;/script&gt;<BR>  &lt;/head&gt;<BR>  <BR>  &lt;body&gt;<BR>     &lt;form id="myform" action="" method="POST" name="<a href='http://www.it.com.cn" target="_blank" ></form'>www.it.com.cn"&gt;&lt;/form</A>&gt;  //但是我用name的时候没有出错啊<BR>     &lt;button onClick="get()"&gt;Get&lt;/button&gt;<BR>  &lt;/body&gt;<BR>&lt;/html&gt;</P>

矿泉水wz 发表于 2007-11-8 15:47

    &lt;meta http-equiv="pragma" content="no-cache"&gt;<BR>    &lt;meta http-equiv="cache-control" content="no-cache"&gt;<BR>    &lt;meta http-equiv="expires" content="0"&gt;    <BR>    &lt;meta http-equiv="keywords" content="keyword1,keyword2,keyword3"&gt;<BR>    &lt;meta http-equiv="description" content="This is my page"&gt;<BR><BR>这些是干什么用的???

netstriker 发表于 2007-11-8 15:49

   没有什么用的。myEclipse自动生成,你可以删掉它,不会影响运行的

矿泉水wz 发表于 2007-11-8 15:51

袄...我用的是5.0版本的.....没看到!<BR>谢谢!!!!

页: [1]

编程论坛