1234

ExcelHome技术论坛

用户名  找回密码
 免费注册

QQ登录

只需一步,快速开始

快捷登录

帖子
EH技术汇-专业的职场技能充电站 妙哉!函数段子手趣味讲函数 Excel服务器-会Excel,做管理系统 效率神器,一键搞定繁琐工作
HR薪酬管理数字化实战 Excel 2021函数公式学习大典 Excel数据透视表实战秘技 打造核心竞争力的职场宝典
让更多数据处理,一键完成 数据工作者的案头书 免费直播课集锦 ExcelHome出品 - VBA代码宝免费下载
用ChatGPT与VBA一键搞定Excel WPS表格从入门到精通 Excel VBA经典代码实践指南
楼主: OKJSJSF

[求助] HTML文档的计算问题

[复制链接]

TA的精华主题

TA的得分主题

 楼主| 发表于 2025-3-1 21:53 | 显示全部楼层
本帖最后由 OKJSJSF 于 2025-3-2 09:35 编辑

<script type="text/javascript">
        var t1b1=document.getElementById("t1b1");
        var t1b2=document.getElementById("t1b2");
        var t1b3=document.getElementById("t1b3");
        var t1b4=document.getElementById("t1b4");
        var t1b5=document.getElementById("t1b5");
        var t1b6=document.getElementById("t1b6");
        var t1b7=document.getElementById("t1b7");
        var t1b8=document.getElementById("t1b8");
        var t1b9=document.getElementById("t1b9");

        const t1c1=document.getElementById("t1c1");
        const t1c2=document.getElementById("t1c2");
        const t1c3=document.getElementById("t1c3");
        const t1c4=document.getElementById("t1c4");
        const t1c5=document.getElementById("t1c5");
        const t1c6=document.getElementById("t1c6");
        const t1c7=document.getElementById("t1c7");
        const t1c8=document.getElementById("t1c8");
        const t1c9=document.getElementById("t1c9");

        const t1d1=document.getElementById("t1d1");
        const t1d2=document.getElementById("t1d2");
        const t1d3=document.getElementById("t1d3");
        const t1d4=document.getElementById("t1d4");
        const t1d5=document.getElementById("t1d5");
        const t1d6=document.getElementById("t1d6");
        const t1d7=document.getElementById("t1d7");
        const t1d8=document.getElementById("t1d8");
        const t1d9=document.getElementById("t1d9");

        
        var t2b1=document.getElementById("t2b1");
        var t2b2=document.getElementById("t2b2");
        var t2b3=document.getElementById("t2b3");
        var t2b4=document.getElementById("t2b4");
        var t2b5=document.getElementById("t2b5");
        var t2b6=document.getElementById("t2b6");
        var t2b7=document.getElementById("t2b7");
        var t2b8=document.getElementById("t2b8");
        var t2b9=document.getElementById("t2b9");
        var t2b10=document.getElementById("t2b10");
        var t2b11=document.getElementById("t2b11");
        var t2b12=document.getElementById("t2b12");
        

        const t2c1=parseFloat(document.getElementById("t2c1").textContent);
        const t2c2=parseFloat(document.getElementById("t2c2").textContent);
        const t2c3=parseFloat(document.getElementById("t2c3").textContent);
        const t2c4=parseFloat(document.getElementById("t2c4").textContent);
        const t2c5=parseFloat(document.getElementById("t2c5").textContent);
        const t2c6=parseFloat(document.getElementById("t2c6").textContent);
        const t2c7=parseFloat(document.getElementById("t2c7").textContent);
        const t2c8=parseFloat(document.getElementById("t2c8").textContent);
        const t2c9=parseFloat(document.getElementById("t2c9").textContent);
        const t2c10=parseFloat(document.getElementById("t2c10").textContent);
        const t2c11=parseFloat(document.getElementById("t2c11").textContent);
        const t2c12=parseFloat(document.getElementById("t2c12").textContent);
        
        var t2d1=document.getElementById("t2d1");
        var t2d2=document.getElementById("t2d2");
        var t2d3=document.getElementById("t2d3");
        var t2d4=document.getElementById("t2d4");
        var t2d5=document.getElementById("t2d5");
        var t2d6=document.getElementById("t2d6");
        var t2d7=document.getElementById("t2d7");
        var t2d8=document.getElementById("t2d8");
        var t2d9=document.getElementById("t2d9");
        var t2d10=document.getElementById("t2d10");
        var t2d11=document.getElementById("t2d11");
        var t2d12=document.getElementById("t2d12");
        
        var t1bs=document.getElementsByName("group1");
        for(var i=0;i<t1bs.length;i++){t1bs.addEventListener("Change",function(){if(this.id==="t1b3" && this.checked && t2b11.checked){t2d11.value=t2c11;}else{t2d11.value="";}
                                                                                                                                                                }
                                                                                                                        )
                                                                };
        
        t2b1.onclick=function(){if(this.checked){if(t1b5.checked||t1b6.checked||t1b7.checked||t1b9.checked){t2d1.value=t2c1;}else{t2d1.value="";}}else{t2d1.value="";}};
        t2b2.onclick=function(){if(this.checked){t2d2.value=t2c2;}else{t2d2.value="";}};
        t2b3.onclick=function(){if(this.checked){t2d3.value=t2c3;}else{t2d3.value="";}};
        t2b4.onclick=function(){if(this.checked){t2d4.value=t2c4;}else{t2d4.value="";}};
        t2b5.onclick=function(){if(this.checked){t2d5.value=t2c5;}else{t2d5.value="";}};
        t2b6.onclick=function(){if(this.checked){t2d6.value=t2c6;}else{t2d6.value="";}};
        t2b7.onclick=function(){if(this.checked){t2d7.value=t2c7;}else{t2d7.value="";}};
        t2b8.onclick=function(){if(this.checked){t2d8.value=t2c8;}else{t2d8.value="";}};
        t2b9.onclick=function(){if(this.checked){t2d9.value=t2c9;}else{t2d9.value="";}};
        t2b10.onclick=function(){if(this.checked){t2d10.value=t2c10;}else{t2d10.value="";}};
        t2b11.onclick=function(){if(this.checked&&t1b3.checked){t2d11.value=t2c11;}else{t2d11.value="";}};
        t2b12.onkeyup=function(){t2d12.value=(t2b12.value*t2c12/100);};
        
</script>

TA的精华主题

TA的得分主题

 楼主| 发表于 2025-3-2 09:42 | 显示全部楼层
好像我的循环监听语句根本没运行。

TA的精华主题

TA的得分主题

 楼主| 发表于 2025-3-9 09:47 | 显示全部楼层
image.jpg 折腾了多天终于能运行计算了。

TA的精华主题

TA的得分主题

 楼主| 发表于 2025-3-9 09:50 | 显示全部楼层
您需要登录后才可以回帖 登录 | 免费注册

本版积分规则

1234

手机版|关于我们|联系我们|ExcelHome

GMT+8, 2025-4-26 14:46 , Processed in 0.020265 second(s), 8 queries , Gzip On, MemCache On.

Powered by Discuz! X3.4

© 1999-2023 Wooffice Inc.

沪公网安备 31011702000001号 沪ICP备11019229号-2

本论坛言论纯属发表者个人意见,任何违反国家相关法律的言论,本站将协助国家相关部门追究发言者责任!     本站特聘法律顾问:李志群律师

快速回复 返回顶部 返回列表