日期:2014-05-16  浏览次数:20458 次

麻烦帮修改下JS代码~~
HTML code
<script language="javascript">

function statu_detail()

{
var SS=document.getElementById("statu_d").value;
var s_info=document.getElementById("status_info");
if(SS!="正常")
{
s_info.value="设备不正常";
}

}

</script>

<input id='statu_d' name="status" type="radio" value="正常" onClick="statu_detail();">正常
<input id='statu_d' name="status" type="radio" value="非正常" onClick="statu_detail();">非正常
<input name="status_info" type="text" id="status_info" value="" size="">


代码有问题。帮忙修改下~~~


------解决方案--------------------
HTML code
<script language="javascript">
function statu_detail(a){
    var s_info=document.getElementById("status_info");
    var SS=a.value;
    if(SS!="正常"){
        s_info.value=SS;
        s_info.style.display="block";
    }else{
        s_info.value='';
        s_info.style.display="none";
    }
}
</script>

<input id='statu_d' name="status" type="radio" value="正常" onClick="statu_detail(this);">正常
<input id='statu_d' name="status" type="radio" value="非正常" onClick="statu_detail(this);">非正常
<input name="status_info" type="text" style="display:none;" id="status_info" value="" size="">

------解决方案--------------------
HTML code

<script language="javascript" type="text/javascript">

    function statu_detail(a) {
        var SS = a.value;
        var s_info = document.getElementById("status_info");
        if (SS != "正常") {
            s_info.value = SS;
            s_info.style.display = "";
        }
        else {
            s_info.value = '';
            s_info.style.display="none";

        }
    }

</script>

<input id='statu_d' name="status" type="radio" value="正常" onClick="statu_detail(this);">正常
<input id='statu_d1' name="status" type="radio" value="非正常" onClick="statu_detail(this);">非正常
<input name="status_info" type="text" style="display:none" id="status_info" value="" size="">