gpt4 book ai didi

php - 如何使用提交按钮并从列表框中选择显示表格

转载 作者:行者123 更新时间:2023-11-30 22:36:49 24 4
gpt4 key购买 nike

这是我的代码,我尝试显示哪个表与我的列表框匹配例如当我从列表框中选择 AIX 并按下我想显示 table1 的按钮时例如,当我从列表框中选择 linux 并按下按钮时,我想显示 table2你能帮我如何为btton和选择表编写代码吗

谢谢

<select  name="System" id="System" style="font: 20pt AngsanaUPC "  onkeyup="showHint(this.value)">
<option value="" style="font: 25pt AngsanaUPC " >Choose system</option>
<option value="AIX" style="font: 25pt AngsanaUPC " >AIX</option>
<option value="LINUX" style="font: 25pt AngsanaUPC ">LINUX</option>
<option value="SOLARIS" style="font: 25pt AngsanaUPC ">SOLARIS</option>
</select>
<button type="submit" class="btn btn-primary" style="font: 20pt AngsanaUPC ">Submit</button></td>

<table cellpadding="0" cellspacing="0" border="0" class="display" id="example" width="100%">
</table>//table 1...

<table cellpadding="0" cellspacing="0" border="0" class="display" id="example2" width="100%">
</table>//table 2....

<table cellpadding="0" cellspacing="0" border="0" class="display" id="example3" width="100%">
</table>// table 3....

最佳答案

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Test</title>

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script type="text/javascript">
function clickMe(){

$("table").hide();
if($("#list").val()==="AIX"){
$("#table1").show();
}else if($("#list").val()==="LINUX"){
$("#table2").show();
}else if($("#list").val()==="SOLARIS"){
$("#table3").show();
}

}
</script>
</head>
<body>
<select id="list">
<option value="" style="font: 25pt AngsanaUPC " >Choose system</option>
<option value="AIX" style="font: 25pt AngsanaUPC " >AIX</option>
<option value="LINUX" style="font: 25pt AngsanaUPC ">LINUX</option>
<option value="SOLARIS" style="font: 25pt AngsanaUPC ">SOLARIS</option>
</select>
<br/>
<input type="button" id="submit" value="submit" onclick="javascript:clickMe()"/>
<br/>
<table id="table1" style="display:none;"><caption>Table 1</caption></table>
<br/>
<table id="table2" style="display:none;"><caption>Table 2</caption></table>

<br/>
<table id="table3" style="display:none;"><caption>Table 3</caption></table>

</body>
</html>

关于php - 如何使用提交按钮并从列表框中选择显示表格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32323552/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com