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

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才对

  • 写回答

6条回答

  • wang1hong2lu3 2015-12-07 09:02
    关注

    你好像有好多个id 是 bc_id的 你那个似乎是循环添加的吧 这样可能回产生很多个相同的id

    评论

报告相同问题?

悬赏问题

  • ¥15 树莓派与pix飞控通信
  • ¥15 自动转发微信群信息到另外一个微信群
  • ¥15 outlook无法配置成功
  • ¥30 这是哪个作者做的宝宝起名网站
  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题