<script type="text/javascript" src="prototype.js"></script>
<script>
function reload(form){
var val = $("seltab");alert(val);
}</script>
echo "<form method = post name = f1 action = '' >";
echo "<select id = seltab onchange = 'reload(this.form)'>";
$querysel = "SELECT title_id,author FROM authors NATURAL JOIN books";
$result1 = mysql_query($querysel) ;
while($rowID = mysql_fetch_assoc($result1))
{
$TitleID = $rowID['title_id'];
$author = $rowID['author'];
print "<option value =$TitleID>$author\n";
print "</option>";
}
print "</select>";
最佳答案
我认为他的意思只是在他的重新加载函数中从选择框中获取值的小 javascript 部分:
$("seltab").getValue();
似乎 API 说甚至还有一个缩写:( http://api.prototypejs.org/dom/form/element/getvalue/ )
$F("seltab")
关于php - 如何在 php 中使用 JS 原型(prototype)从 Select html 元素中检索值?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2583188/