html通过javascript动态显示和隐藏某个节点

效果
html通过javascript动态显示和隐藏某个节点_第1张图片

代码

<input id="order_check" name='subject' type="checkbox" onclick="OnOrderCheckboxClicked()" /><label>预约label>
<input id="order_time" type="datetime-local" value="2020-01-01T00:00:00" style="visibility:hidden"/>

<script>
function OnOrderCheckboxClicked()
{
	var order_check = document.getElementById('order_check');
	var order_time = document.getElementById('order_time');
	if(order_check.checked)
	{
	    order_time.style.visibility='visible';
	}
	else
	{
	    order_time.style.visibility='hidden'; 
	}
}

script>

你可能感兴趣的:(html通过javascript动态显示和隐藏某个节点)