快捷导航
发新帖
返回列表
<!DOCTYPE html>
<html>
<head>
        <meta charset="UTF-8">
        <title>javascript</title>
        <script type="text/javascript">
                var x=document.getElementsByName("name1").value;
                   function textjs()
                {
                        if (x=="")
                         {
                                 alert("请输入您的姓名");
                                 return ture;
                         }
                         else
                         {
                                 alert("欢迎您"+x);
                         }
                }
        </script>
</head>
<body>
        <form name="form1" action="simple.html">
                姓名:<input type="text" name="name1"/>
                <input type="submit" value="提交"/>
        </form>
       
</body>
</html>

我明明定义了X值为name为什么编译出来是没有定义的呢?

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
举报 使用道具
| 回复

共0个回复 最后回复于 2016-9-5 20:52

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

快速回复 返回顶部 返回列表