html:单月查询:<input type="radio" onclick="return sign();" name="select" />
多月查询:<input type="radio" onclick="return more();" name="select" />
查询日期: <span>
<asp:DropDownList runat="server" ID="ddlYear">
</asp:DropDownList>
<asp:DropDownList runat="server" ID="ddlMonth">
</asp:DropDownList>
</span> <span id="endDate">——
<asp:DropDownList runat="server" ID="ddlYearEnd">
</asp:DropDownList>
<asp:DropDownList runat="server" ID="ddlMonthEnd">
</asp:DropDownList>
</span>js<script type="text/javascript" language="javascript">
function sign() {
var newSpan = document.getElementById("endDate");
newSpan.style.display = "none";
}
function more() {
var newSpan = document.getElementById("endDate");
newSpan.style.display = "block";
}
</script>初始效果是在一行,点击多月查询时结束年月另起了一行…这是为什么?查看源文件没发现什么区别…
多月查询:<input type="radio" onclick="return more();" name="select" />
查询日期: <span>
<asp:DropDownList runat="server" ID="ddlYear">
</asp:DropDownList>
<asp:DropDownList runat="server" ID="ddlMonth">
</asp:DropDownList>
</span> <span id="endDate">——
<asp:DropDownList runat="server" ID="ddlYearEnd">
</asp:DropDownList>
<asp:DropDownList runat="server" ID="ddlMonthEnd">
</asp:DropDownList>
</span>js<script type="text/javascript" language="javascript">
function sign() {
var newSpan = document.getElementById("endDate");
newSpan.style.display = "none";
}
function more() {
var newSpan = document.getElementById("endDate");
newSpan.style.display = "block";
}
</script>初始效果是在一行,点击多月查询时结束年月另起了一行…这是为什么?查看源文件没发现什么区别…
block就是显示并独占一行的,如果要显示并不独点一行,可以指定float,
或者有预留空间的话,用visibility:visible /hidden 显示隐藏
不要block
<script src="Scripts/jquery-1.4.1.min.js" type="text/javascript"></script>
<script type="text/javascript" language="javascript">
function sign() {
//var newSpan = document.getElementById("endDate");
//newSpan.style.display = "none";
$("#endDate").hide();//引用jquery
}
function more() {
//var newSpan = document.getElementById("endDate");
//newSpan.style.display = "block";
$("#endDate").show();
}
</script>