当前位置: 代码迷 >> JavaScript >> 异常提示:TypeError,请帮忙看看下面什么错?奇怪了
  详细解决方案

异常提示:TypeError,请帮忙看看下面什么错?奇怪了

热度:157   发布时间:2012-03-04 11:13:33.0
错误提示:TypeError,请帮忙看看下面什么错?奇怪了
<html>
<head>
<meta   http-equiv= "Content-Type "   content= "text/html;   charset=gb2312 "   />
<title> 无标题文档 </title>
<script   language= "javascript ">
var   t;
t   =   prompt( "请问您的姓名: ",0);
try
{
if(t   !=   null   ||   t   !=   " ")
{
      document.form1.textfield.value   =   t;
}
else
{
document.form1.textfield.value   =   " ";
}
}
catch(err)
{
alert(err.name);
}
t   =   prompt( "请问您的年龄? ");
document.form1.textfield2.value   =   t;

if(window.confirm( "您是男的? "))
{
        document.form1.textfield3.value   =   "男人 ";
}
else
{
        document.form1.textfield3.value   =   "女人 ";
}

function   getAllValue()
{
var   k   =   document.form1;
        document.writeln(k.textfield.value   +   " <br> "   +   k.textfield2.value   +   " <br> "   +   k.textfield3.value   +   " <br> "   +   document.body.innerHTML);
}
</script>
</head>

<body>
<form   id= "form1 "   name= "form1 "   method= "post "   action= " ">
    <table   width= "100% "   border= "0 "   cellpadding= "3 "   cellspacing= "1 "   bgcolor= "#000000 ">
        <tr>
            <td   bgcolor= "#FFFFFF "> <label   for= "textfield "> 姓名: </label>
            <input   type= "text "   name= "textfield "   id= "textfield "   /> </td>
        </tr>
        <tr>
            <td   bgcolor= "#FFFFFF "> <label   for= "label "> 年龄: </label>
            <input   type= "text "   name= "textfield2 "   id= "label "   /> </td>
        </tr>
        <tr>
            <td   bgcolor= "#FFFFFF "> <label   for= "label2 "> 性别 </label>
            <input   type= "text "   name= "textfield3 "   id= "label2 "   /> </td>
        </tr>
        <tr>
            <td   bgcolor= "#FFFFFF "> <label   for= "Submit "> 确定 </label>
            <input   type= "button "   name= "Submit "   value= "确定 "   id= "Submit "   onClick= "getAllValue() "/> </td>
        </tr>
    </table>

</form>
</body>
  相关解决方案