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

HTML中的alert的运用,帮帮忙
<%@   page   language= "java "   pageEncoding= "ISO-8859-1 "%>
<%@   taglib   uri= "http://struts.apache.org/tags-bean "   prefix= "bean "   %>
<%@   taglib   uri= "http://struts.apache.org/tags-html "   prefix= "html "   %>
<%@   taglib   uri= "http://struts.apache.org/tags-logic "   prefix= "logic "   %>
<%@   taglib   uri= "http://struts.apache.org/tags-tiles "   prefix= "tiles "   %>
<html>
    <head>
        <title> MyJsp.jsp </title>
        <script   type= "text/javascript ">
function   al()
{
alert(radio1.value);
}
        </script>
</head>
<body>
<table   width= "100% "   border= "1 "   height= "40% ">
<tr> <td   align=center   width= "40% "   height=400>
<table>
  <tr> <td> <strong> 请输入编号 </strong> <br> <input   type=text   name=number   /> </td> </tr>
              </table>
    </td>
<td> <strong> 点击选择类型 </strong>
  <br> <input   type= "radio "   name= "radio1 "   checked=checked   value= "A "   /> A
  <br> <input   type= "radio "   name= "radio1 "   value= "B "   /> B
  <br> <input   type= "radio "   name= "radio1 "   value= "C "   /> C
  <br>
  <br> <input   type=button   name=cancle   value= "取消 "/>
    <input   type=button   name=next   value= "上一步 "   />
            <input   type=button   name=next   value= "进入 ";   onclick= "al() "   />
</td> </tr>
</table>
  </body>
</html>


我按了进入按钮后,就提示undefine,请问一下哪里错了?


------解决方案--------------------
<script>
function b()
{
o = document.getElementsByName( "a ");
for(c=0;c <o.length;c++)
{
if(o[c].checked) alert(o[c].value);
}
}
</script>
<input type= "radio " name= "a " value= "a ">
<input type= "radio " name= "a " value= "b ">
<input type= "radio " name= "a " value= "c ">
<input type= "button " onclick= "b() ">
------解决方案--------------------
<!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> 无标题文档 </title>
<script type= "text/javascript ">
function al()
{
var radio1 = document.getElementsByTagName( &q