我有下面的代碼運行良好的下拉菜單,但你可以看到第二個值(next_val = 250f3)是靜態的。我想使動態應該改變點擊。PHP阿賈克斯傳遞兩個值 - 1個下拉菜單中的2個按鈕
<script type="text/javascript">
function showUser(str)
{
if (str == "")
{
document.getElementById("txtHint").innerHTML = "";
return;
}
if (window.XMLHttpRequest)
{
xmlhttp = new XMLHttpRequest();
}
else
{
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange = function()
{
if (xmlhttp.readyState == 4 && xmlhttp.status == 200)
{
document.getElementById("txtHint").innerHTML = xmlhttp.responseText;
}
}
xmlhttp.open("GET", "productlistajax.php?q=" + str + "&next_val=250f3", true);
xmlhttp.send();
}
</script>
這裏是下拉菜單代碼。
<select id="maxDaysSinceAdded" name="shorting" onchange="showUser(this.value)">
<option selected='selected' value="1">Most Recent</option>
<option value="2">Lowest Price</option>
<option value="3">Highst Price</option>
</select>
如何使用按鈕來傳遞值以上住下拉菜單
<button type="button" name="buttonpassvalue" onclick="">Value</button>
感謝
我不明白你的價值,你希望把next_val。 – thelr