我希望 Javascript 提醒整个员工姓名(名字和姓氏),但是使用此代码,由于某种原因它只显示名字。关于如何解决这个问题的任何想法?
这是我的代码:
if ( $even1 % 2)
echo "<option value=". $employee_firstname . " " . $employee_lastname . ">". $employee_firstname . " " . $employee_lastname . "</option>";
else
echo "<option value=". $employee_firstname . " " . $employee_lastname . ">". $employee_firstname . " " . $employee_lastname . "</option>";
的JavaScript:
var List = document.getElementById('slcEmp');
var x = 0;
for (x = 0; x < List.length; x++) {
if (List[x].selected) {
alert(List[x].value);
}
}