我现在正在制作表格,我想知道如何在选择“其他”或“选项3”选项后如何让脚本显示文本框。
HTML:
<select name="choice" onchange="if(this.selectedIndex==5)
{this.form['other'].style.visibility='visible'}else
{this.form['other'].style.visibility='hidden'};">
<option value="" selected="selected">Select...</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="other">Other</option>
</select>
<input type="textbox" name="other" style="visibility:hidden; margin-left:3px"/>
Javascript:
window.addEvent('domready', function() {
$('hearabout').addEvent('change', function() {
if ($('hearabout').value == 'Rekening' ) {
$('other_input').setStyle('display', 'block');
} else {
$('other_input').setStyle('display', 'none');
}
});
if ($('hearabout').value == 'Rekening' ) {
$('other_input').setStyle('display', 'block');
} else {
$('other_input').setStyle('display', 'none');
}
});
如何更改“ this.selectedIndex == 5”,使其同时使用选项3和5?
谢谢
<select id='someth'>
$('#someth').on('change', function(){ if (('#someth').val() == "other") { $('#YourInputID').css('display','block'); } });
不要错过添加display:none;
输入样式
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句