gpt4 book ai didi

php - 在选择上显示结果

转载 作者:行者123 更新时间:2023-11-28 09:32:14 25 4
gpt4 key购买 nike

我正在使用下面的代码,它显示???仅代替结果。您能帮我纠正下面表格中的错误吗?消息显示空白结果,如 ??格式。有什么帮助吗? --

<table width="100%" border="0" cellspacing="2" cellpadding="2">
<tr>
<td width="12%">&nbsp;</td>
<td width="2%">&nbsp;</td>
<td width="2%">&nbsp;</td>
<td width="2%">&nbsp;</td>
<td width="16%">&nbsp;</td>
<td width="66%">&nbsp;</td>
</tr>
<tr>
<td><img src="images/australia1.jpg" width="132" height="70"></td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td><select name="select">
<option>Select Course Type</option>
<option>Under Graduate</option>
<option>Post Graduate</option>
</select>
</td>
<td><div id="message"></div>​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>

</table>
<script type="text/javascript" language="javascript">
var messages = {
Under Graduate: 'UG text is here',
Post Graduate: 'PG text is here'
}
$('select').change(function() {
$('#message').text(messages[$(this).val()]);
});​
</script>

最佳答案

<script type="text/javascript" language="javascript">
var messages = {
under: 'UG text is here',
post: 'PG text is here'
}
$('select').change(function() {
if($(this).val() != '')
$('#message').text(messages[$(this).val()]);
});​
</script>

<select name="select">
<option value="">Select Course Type</option>
<option value="under">Under Graduate</option>
<option value="post">Post Graduate</option>
</select>

关于php - 在选择上显示结果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13605181/

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