qq_16188625
2015-12-07 08:30
采纳率: 0%
浏览 2.6k

document.getElementById()获取的值不对

 <html>
<head>
<title>控制首页</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<link rel="stylesheet" type="text/css" href="css/table.css">
</head>
<script type="text/javascript">
    function checkState() {
        var bc_id = document.getElementById("bc_id").value;
        var bc_state = document.getElementById("bc_state").value;
        alert("bc_id======="+bc_id+"******************bc_state========"+bc_state);
        document.form1.action = 'AutoBatchConfig_updateAutoBatchState.action?bc_id='+bc_id+'&bc_state'+bc_state;
    }
</script>
<body>
    <center>
    <form action="" method="post" id="form1" name="form1">
        <div style="overflow-x: auto; overflow-y: auto; width: auto; height: 490px">
            <table cellspacing="0">
                <tr>
                    <td style="width:778px;">服 务 拨 测 控 制 台</td>
                </tr>
            </table>
            <table cellspacing="0">
                <tr style="text-align: center;">
                    <th scope="col" style="width:150px">序列</th>
                    <th scope="col" style="width:400px">控制项</th>
                    <th scope="col" style="width:200px">任务状态</th>
                </tr>
                <s:iterator value="#request.autoBatchConfigList" var="rel" status="st">
                    <tr>
                        <th scope="col" style="width:150px">
                            <s:property value="#rel.bc_id" />
                        </th>
                        <th scope="col" style="width:400px">
                            <s:property value="#rel.bc_name" />
                        </th>
                        <th scope="col" style="width:200px">
                            <s:if test="%{#rel.bc_state == \"1\"}">
                                <input type="image" src="images/stop.gif" onclick="checkState()" title="<s:property value="#rel.bc_id"/>"/>
                            </s:if> 
                            <s:else>
                                <input type="image" src="images/running.gif" onclick="checkState()" title="<s:property value="#rel.bc_id"/>"/>
                            </s:else>
                            <input type="text" id="bc_id" value="<s:property value="#rel.bc_id"/>" style="width:50px;"/> 
                            <input type="text" id="bc_state" value="<s:property value="#rel.bc_state"/>" style="width:50px;"/>
                        </th>
                    </tr>
                </s:iterator>
            </table>
        </div>
    </form>
    </center>
</body>

</html>

图片说明
点击序列“3”后的小红色图片
图片说明

结果应该是bc_id=3,bc_state=1才对

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

7条回答 默认 最新

相关推荐 更多相似问题