难忘的JS传参问题
来源:互联网 发布:php 微信开发 编辑:程序博客网 时间:2024/05/29 14:29
在做微信支付的时候,支付按钮一直点击不动
随机拿了一个用户的浏览器信息:
"Mozilla/5.0 (iPhone; CPU iPhone OS 9_3_2 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko)
Mobile/13F69 MicroMessenger/6.5.8
NetType/WIFI Language/zh_CN"
Google模拟调试也没用~
调用特么没任何反应,用户一直反馈说按钮点击没反应,茫然了好几天
------------------------------------------------------
今天晚上终于有一位用户拿了一台iPhone过来调试。晕死
发现2个问题:
1、用了这种传参获取form表单数据
getFormJson(){ var obj = {}; var t = $(form).serializeArray(); $.each(t, function() { obj[this.name] = this.value; }); return obj;}var _form = getFormJson('#top-up-mifi-form');改成:
var _form = {};var t = $('#top-up-mifi-form').serializeArray();$.each(t, function() { _form[this.name] = this.value;});
2、这种也不行,不知道是不是我不熟悉js语法
function disableFunc(i=true){ if(i == true){ document.getElementById("topUp").setAttribute("disabled", "disabled"); document.getElementById("topUp-auto").setAttribute("disabled", "disabled"); document.getElementById("topUp-noAuto").setAttribute("disabled", "disabled"); } else{ document.getElementById("topUp").removeAttribute("disabled"); document.getElementById("topUp-auto").removeAttribute("disabled"); document.getElementById("topUp-noAuto").removeAttribute("disabled"); } }
改成:
function disableFunc(i){ if(i == ''){ i == true; } if(i == true){ document.getElementById("topUp").setAttribute("disabled", "disabled"); document.getElementById("topUp-auto").setAttribute("disabled", "disabled"); document.getElementById("topUp-noAuto").setAttribute("disabled", "disabled"); } else{ document.getElementById("topUp").removeAttribute("disabled"); document.getElementById("topUp-auto").removeAttribute("disabled"); document.getElementById("topUp-noAuto").removeAttribute("disabled"); } }
哪位前辈知道这是啥问题,一脸茫然~
阅读全文
0 0
- 难忘的JS传参问题
- 难忘的
- 难忘的时刻
- 难忘的圣诞夜
- 难忘的鸡汤
- 难忘的eclipse
- 难忘的一天~
- 一次难忘的鄙视
- 一次难忘的shopping
- 难忘的午饭
- 难忘的比赛
- 难忘的岁月
- 难忘的2.14
- 这难忘的周末
- 一次难忘的面试
- 难忘的生日party
- 难忘的2010
- 难忘的国庆节
- 习题 5.11 一个球从100m高度自由落下,每次落地后反跳回原高度的一半,再落下,再反弹。求它在第10次落地时,共经过多少米,第10次反弹多高。
- 古文觀止卷八_圬者王承福傳_韓愈
- 已知前序遍历和中序遍历的结果求后序遍历
- js反转字符串方法
- 使用ImageLoader实例 进行加载图片
- 难忘的JS传参问题
- 用二维数组写的简单的推箱子,一个人,两个箱子,两个圈的情况。。
- HDU2643 Rank 第二类斯特林数
- permutation
- jsp基础—1
- java System类
- Java中的泛型
- 可变参列表
- 集成springmvc和mybatis环境的Javaweb基础框架,省去新手搭建繁琐环境的苦恼