这个联动的字段效果怎么实现-求代码 通过元素的 display 属性控制none为不显示"" 为显示 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <dt>类型:</dt><dd><label><input type="radio" name="bstype" onclick="a()" />求租/求购</label><label><input type="radio" name="bstype" onclick="b()" />出租/转让</label></dd><dt>租让意向:</dt><dd><span id="sbstype2"><label><input type="radio" name="rtype" onclick="c()" />出租</label><label><input type="radio" name="rtype" onclick="d()" />转让</label><label><input type="radio" name="rtype" onclick="e()" />出租/出让</label></span><span id="sbstype1"><label><input type="radio" name="rtype" onclick="e()" />求租</label><label><input type="radio" name="rtype" onclick="e()" />求租/求购</label></span><span id="sadd"><dt>地址:</dt><dd><input name="add"/></dd></span><span id="sprice"><dt>价格:</dt><dd><label><input size="6" name="price" />英镑</label></dd></span><span id="srent"><dt>租金:</dt><dd>£<input size="5" id="rent" name="rent"/>/周 (p/w)</dd></span><script language="javascript">function a() { document.getElementById("sbstype2").style.display = "none"; document.getElementById("sbstype1").style.display = ""; document.getElementById("sadd").style.display = "none";}function b() { document.getElementById("sbstype1").style.display = "none"; document.getElementById("sbstype2").style.display = ""; document.getElementById("sadd").style.display = "";}function c() { document.getElementById("sprice").style.display = "none"; document.getElementById("srent").style.display = "";}function d() { document.getElementById("srent").style.display = "none"; document.getElementById("sprice").style.display = "";}function e() { document.getElementById("sprice").style.display = ""; document.getElementById("srent").style.display = "";}</script> 谢谢, 有个问题, 在FF下面, 地址不会隐藏, 但是在IE下面会, 也就是a()下的sadd隐藏,在firefox下面不起作用。 这是为什么? <dt>类型:</dt><dd><label><input type="radio" name="bstype" onclick="a()" />求租/求购</label><label><input type="radio" name="bstype" onclick="b()" />出租/转让</label></dd><dt>租让意向:</dt><dd><span id="sbstype2"><label><input type="radio" name="rtype" onclick="c()" />出租</label><label><input type="radio" name="rtype" onclick="d()" />转让</label><label><input type="radio" name="rtype" onclick="e()" />出租/出让</label></span><span id="sbstype1"><label><input type="radio" name="rtype" onclick="e()" />求租</label><label><input type="radio" name="rtype" onclick="e()" />求租/求购</label></span></dd><span id="sadd" style="display:none"><dt>地址:</dt><dd><input name="addr"/></dd></span><span id="sprice"><dt>价格:</dt><dd><label><input size="6" name="price" />英镑</label></dd></span><span id="srent"><dt>租金:</dt><dd>£<input size="5" id="rent" name="rent"/>/周 (p/w)</dd></span><script language="javascript">function a() { document.getElementById("sbstype2").style.display = "none"; document.getElementById("sbstype1").style.display = ""; document.getElementById("sadd").style.display = "none";}function b() { document.getElementById("sbstype1").style.display = "none"; document.getElementById("sbstype2").style.display = ""; document.getElementById("sadd").style.display = "";}function c() { document.getElementById("sprice").style.display = "none"; document.getElementById("srent").style.display = "";}function d() { document.getElementById("srent").style.display = "none"; document.getElementById("sprice").style.display = "";}function e() { document.getElementById("sprice").style.display = ""; document.getElementById("srent").style.display = "";}</script> <dt>类型:</dt><dd><label><input type="radio" name="bstype" onclick="a()" />求租/求购</label><label><input type="radio" name="bstype" onclick="b()" />出租/转让</label></dd><dt>租让意向:</dt><dd><span id="sbstype2"><label><input type="radio" name="rtype" onclick="return c()" />出租</label><label><input type="radio" name="rtype" onclick="return d()" />转让</label><label><input type="radio" name="rtype" onclick="return e()" />出租/出让</label></span><span id="sbstype1"><label><input type="radio" name="rtype" onclick="return e()" />求租</label><label><input type="radio" name="rtype" onclick="return e()" />求租/求购</label></span></dd><span id="sadd" style="display:none"><dt>地址:</dt><dd><input name="addr"/></dd></span><span id="sprice"><dt>价格:</dt><dd><label><input size="6" name="price" />英镑</label></dd></span><span id="srent"><dt>租金:</dt><dd>£<input size="5" id="rent" name="rent"/>/周 (p/w)</dd></span><script language="javascript">function a() { document.getElementById("sbstype2").style.display = "none"; document.getElementById("sbstype1").style.display = ""; document.getElementById("sadd").style.display = "none";}function b() { document.getElementById("sbstype1").style.display = "none"; document.getElementById("sbstype2").style.display = ""; document.getElementById("sadd").style.display = "";}function c() { if (!f()) return false; document.getElementById("sprice").style.display = "none"; document.getElementById("srent").style.display = "";}function d() { if (!f()) return false; document.getElementById("srent").style.display = "none"; document.getElementById("sprice").style.display = "";}function e() { if (!f()) return false; document.getElementById("sprice").style.display = ""; document.getElementById("srent").style.display = "";}function f() { var bstype = document.getElementsByName("bstype"); for(var i = 0; i < bstype.length; i++) { if (bstype[i].checked) return true; } alert("请先选择类型"); return false;}</script> js,真是祸害不浅。 怎样用JavaScript获取表格的html值,在firefox下也有效 阿拉伯数字转中文大写用JS怎么转? iframe 页面的控制(有兴趣的来看看吧) 关于日历插件 问题如图 高分请教!Select框复制问题 我是要当前窗口,弹出一个新的窗口,同时自己关闭.同时,不需要弹出任何关闭窗口确定的消息. 如何在一个复选框被选中时,让另一个文本框变为不可用 jquery自定义动画的速度曲线控制? 如果用VBScript和JavaScript替换所有HTML标记? *********************************为什么加个alert之后 程序就出错了????
<dd><label><input type="radio" name="bstype" onclick="a()" />求租/求购</label>
<label><input type="radio" name="bstype" onclick="b()" />出租/转让</label></dd>
<dt>租让意向:</dt>
<dd><span id="sbstype2"><label><input type="radio" name="rtype" onclick="c()" />出租</label><label><input type="radio" name="rtype" onclick="d()" />转让</label><label><input type="radio" name="rtype" onclick="e()" />出租/出让</label></span><span id="sbstype1"><label><input type="radio" name="rtype" onclick="e()" />求租</label><label><input type="radio" name="rtype" onclick="e()" />求租/求购</label></span>
<span id="sadd"><dt>地址:</dt><dd><input name="add"/></dd></span>
<span id="sprice"><dt>价格:</dt><dd><label><input size="6" name="price" />英镑</label></dd></span>
<span id="srent"><dt>租金:</dt><dd>£<input size="5" id="rent" name="rent"/>/周 (p/w)</dd></span>
<script language="javascript">
function a() {
document.getElementById("sbstype2").style.display = "none";
document.getElementById("sbstype1").style.display = "";
document.getElementById("sadd").style.display = "none";
}
function b() {
document.getElementById("sbstype1").style.display = "none";
document.getElementById("sbstype2").style.display = "";
document.getElementById("sadd").style.display = "";
}
function c() {
document.getElementById("sprice").style.display = "none";
document.getElementById("srent").style.display = "";
}
function d() {
document.getElementById("srent").style.display = "none";
document.getElementById("sprice").style.display = "";
}
function e() {
document.getElementById("sprice").style.display = "";
document.getElementById("srent").style.display = "";
}
</script>
也就是a()下的sadd隐藏,在firefox下面不起作用。 这是为什么?
<dd><label><input type="radio" name="bstype" onclick="a()" />求租/求购</label>
<label><input type="radio" name="bstype" onclick="b()" />出租/转让</label></dd>
<dt>租让意向:</dt>
<dd><span id="sbstype2"><label><input type="radio" name="rtype" onclick="c()" />出租</label><label><input type="radio" name="rtype" onclick="d()" />转让</label><label><input type="radio" name="rtype" onclick="e()" />出租/出让</label></span><span id="sbstype1"><label><input type="radio" name="rtype" onclick="e()" />求租</label><label><input type="radio" name="rtype" onclick="e()" />求租/求购</label></span></dd>
<span id="sadd" style="display:none"><dt>地址:</dt><dd><input name="addr"/></dd></span>
<span id="sprice"><dt>价格:</dt><dd><label><input size="6" name="price" />英镑</label></dd></span>
<span id="srent"><dt>租金:</dt><dd>£<input size="5" id="rent" name="rent"/>/周 (p/w)</dd></span>
<script language="javascript">
function a() {
document.getElementById("sbstype2").style.display = "none";
document.getElementById("sbstype1").style.display = "";
document.getElementById("sadd").style.display = "none";
}
function b() {
document.getElementById("sbstype1").style.display = "none";
document.getElementById("sbstype2").style.display = "";
document.getElementById("sadd").style.display = "";
}
function c() {
document.getElementById("sprice").style.display = "none";
document.getElementById("srent").style.display = "";
}
function d() {
document.getElementById("srent").style.display = "none";
document.getElementById("sprice").style.display = "";
}
function e() {
document.getElementById("sprice").style.display = "";
document.getElementById("srent").style.display = "";
}
</script>
<dd><label><input type="radio" name="bstype" onclick="a()" />求租/求购</label>
<label><input type="radio" name="bstype" onclick="b()" />出租/转让</label></dd>
<dt>租让意向:</dt>
<dd><span id="sbstype2"><label><input type="radio" name="rtype" onclick="return c()" />出租</label><label><input type="radio" name="rtype" onclick="return d()" />转让</label><label><input type="radio" name="rtype" onclick="return e()" />出租/出让</label></span><span id="sbstype1"><label><input type="radio" name="rtype" onclick="return e()" />求租</label><label><input type="radio" name="rtype" onclick="return e()" />求租/求购</label></span></dd>
<span id="sadd" style="display:none"><dt>地址:</dt><dd><input name="addr"/></dd></span>
<span id="sprice"><dt>价格:</dt><dd><label><input size="6" name="price" />英镑</label></dd></span>
<span id="srent"><dt>租金:</dt><dd>£<input size="5" id="rent" name="rent"/>/周 (p/w)</dd></span>
<script language="javascript">
function a() {
document.getElementById("sbstype2").style.display = "none";
document.getElementById("sbstype1").style.display = "";
document.getElementById("sadd").style.display = "none";
}
function b() {
document.getElementById("sbstype1").style.display = "none";
document.getElementById("sbstype2").style.display = "";
document.getElementById("sadd").style.display = "";
}
function c() {
if (!f()) return false;
document.getElementById("sprice").style.display = "none";
document.getElementById("srent").style.display = "";
}
function d() {
if (!f()) return false;
document.getElementById("srent").style.display = "none";
document.getElementById("sprice").style.display = "";
}
function e() {
if (!f()) return false;
document.getElementById("sprice").style.display = "";
document.getElementById("srent").style.display = "";
}
function f() {
var bstype = document.getElementsByName("bstype");
for(var i = 0; i < bstype.length; i++) {
if (bstype[i].checked) return true;
}
alert("请先选择类型");
return false;
}
</script>