【发布时间】:2014-01-16 08:31:31
【问题描述】:
我正在尝试使用输入元素获取对象值,但它不起作用,这是我尝试过的
var operator = new Object();
operator.name = document.getElementById("name").value;
operator.country = document.getElementById("country").value;
operator.occupation = document.getElementById("occupation").value;
operator.status = document.getElementById("status").value;
alert(operator.name + operator.country + operator.occupation + operator.status);
它一直在提醒 undefined。
<form action="process.php" method="post" onsubmit="return myValidate()" name="myform">
姓名:
国家:
职业:
状态:
【问题讨论】:
-
控制台出现什么错误? ..但它不起作用?
-
不工作意味着什么?
标签: javascript html forms object