ITeye博客

浮动DIV

hwpok · 2010-02-02 19:01 · Html · Markdown

<td width="100"><input type="text" name="dataAddByManualReq.SSubscrMonth" id="SSubscrMonth" onclick="javascript:document.getElementById('monthDiv').style.display='';" class="text" readonly/><br/><div id="monthDiv" style='position:absolute; width:40; height:60;z-index:100;background:red; display:none;'>
                                            <table>
                                                <tr>
                                                    <td colspan="4" style="text-align:right;"><a onclick="javascript:document.getElementById('monthDiv').style.display='none';" style="cursor:pointer;">关闭</a></td>
                                                </tr>
                                                <tr>
                                                    <td><input type="checkBox" name="huyMonth" value="1月"/>1月</td>
                                                    <td><input type="checkBox" name="huyMonth" value="2月"/>2月</td>
                                                    <td><input type="checkBox" name="huyMonth" value="3月"/>3月</td>
                                                    <td><input type="checkBox" name="huyMonth" value="4月"/>4月</td>
                                                </tr>
                                                <tr>
                                                    <td><input type="checkBox" name="huyMonth" value="5月"/>5月</td>
                                                    <td><input type="checkBox" name="huyMonth" value="6月"/>6月</td>
                                                    <td><input type="checkBox" name="huyMonth" value="7月"/>7月</td>
                                                    <td><input type="checkBox" name="huyMonth" value="8月"/>8月</td>
                                                </tr>
                                                <tr>
                                                    <td><input type="checkBox" name="huyMonth" value="9月"/>9月</td>
                                                    <td><input type="checkBox" name="huyMonth" value="10月"/>10月</td>
                                                    <td><input type="checkBox" name="huyMonth" value="11月"/>11月</td>
                                                    <td><input type="checkBox" name="huyMonth" value="12月"/>12月</td>
                                                </tr>
                                                <tr>
                                                    <script type="text/javascript">
                                                        function addMonth()
                                                        {
                                                            var checkBoxArr = document.getElementsByName("huyMonth");
                                                            
                                                            var monthStr = "";
                                                            for(var i=0; i<checkBoxArr.length; i++)
                                                            {
                                                                if(checkBoxArr[i].checked)
                                                                {
                                                                    monthStr += "," + checkBoxArr[i].value;
                                                                }
                                                            }
                                                            
                                                            if(monthStr.length>0)
                                                            {
                                                                monthStr = monthStr.substr(1);
                                                            }
                                                            document.getElementById("SSubscrMonth").value=monthStr;
                                                        }
                                                    </script>
                                                    <td colspan="4" style="text-align:center;"><a onclick="javascript:addMonth()" style="cursor:pointer;">确定</a></td>
                                                </tr>
                                            </table>
                                        </div></td>

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。