我想通过单击链接自动填充两个输入元素。这是我正在使用的代码:
<script>
function autoFill(depart_from, depart_to) {
document.getElementById('depart_from').value = depart_from;
document.getElementById('depart_to').value = depart_to;
}
</script>
这是链接:
...
echo "<tr class='odd'>";
echo "<td><span class='hover'><ahref='#'onClick='autoFill(" . $row['departure'] . ", " . $row['destination'] . "return false;'>" . $row['departure'] ." » ". $row['destination'] . "</a><span></td>";
echo "</tr>";
不能让它工作!我究竟做错了什么?
谢谢!