function方法控制是否隐藏部分内容

$(document).ready(function() {
	    $('input[type=radio][name=IE]').change(function() {
	        if (this.value == 'I') {
	        	 $("#trpre_port_name").show();
	        	$("#trnext_port_name").hide(); 
	        	
	        }else if (this.value == 'E') {
	        	 $("#trpre_port_name").hide();
	        	$("#trnext_port_name").show(); 
	        }else if (this.value == 'IE') {
	        	$("#trpre_port_name").show();
	        	$("#trnext_port_name").show();
	        }else if (this.value == 'O') {
	        	$("#trpre_port_name").show();
	        	$("#trnext_port_name").show();
	        }
	        
	    });
	});

  

<table>
				<tr>
					<td>
						进出口
					</td>
					<td>
						<span class="radioSpan">
						<input type="radio" name="IE" value="IE" checked>进出口</input>
						<input type="radio" name="IE" value="I" >进口</input>
		                <input type="radio" name="IE" value="E">出口</input>
		                <input type="radio" name="IE" value="O">其他</input>
                    </span>
					</td>
				</tr>
				<tr id="trpre_port_name">

					<td>
						上一个名称
					</td>
					<td>

						<input type="text" id="pre_port_name" name="pre_port_name" class="easyui-validatebox" />

					</td>
				</tr>
				<tr id="trnext_port_name">
					<td>
						下一个名称
					</td>
					<td>

						<input type="text" id="next_port_name" name="next_port_name" class="easyui-validatebox" />
				</tr>
			</table>

  

猜你喜欢

转载自www.cnblogs.com/ynhk/p/9269195.html