javascript - Chrome 中未获取变量的值
问题描述
我在 Javascript 中有以下代码片段
<td ALIGN=\"CENTER\" CHAROFF=\"1\">
<button NAME=\"Add\" TYPE=\"button\" SIZE=\"20\" " + addButtonDisable + " onClick=\"processForm(this.value)\">Add</button>
<font face=\"Times New Roman\" size=\"6\"> </font>
<button NAME=\"Update\" TYPE=\"button\" SIZE=\"20\" VALUE=\"Update\" " + updateButtonDisable + " onClick=\"processForm(this.value)\">Update</button>
</td>
</tr>
此处单击“添加”或“更新”按钮应调用 processForm(this.value) 函数。我在这里面临的问题是 this.value 在 IE11 中返回正确的值,但是当我在 Chrome 或 Edge 浏览器中尝试相同的事情时,它给了我 this.value 的空值。为什么 this.value 在这里不兼容?还有其他方法可以在这里实现吗?
下面是processForm函数
function processForm(message) {
if (!validate()) {
return(false);
}
document.EMPLOYEE.AddOrUpdate.value = message;
window.status = message;
if (window.status = document.EMPLOYEE.EMPLOYEEID.value == "0") {
alert("Please select a Reviewer.");
} else {
var browser = IdentifyBrowserIE();
if(browser == "IE"){
document.EMPLOYEE.submit();
}else{
document.forms["EMPLOYEE"].submit();
}
}
}
解决方案
推荐阅读
- node.js - 猫鼬:MissingSchemaError:模式尚未注册模型
- applescript - 通过 Apple 脚本从网页获取数据
- r - ggplot2 闪避箱线图,geom_point 闪避和不等数量的子组
- java - 未找到 Pubsub 订阅用户代理配置
- node.js - 节点js中的视频流
- python - 使用多边骰子类创建怪物战斗
- properties - UI 路径如何更改默认活动属性
- .net - Flush 和 Write 调用的特定组合会破坏通过 OpenWrite 使用的 BlockBlob
- asp.net-core - Http 400 Bad Request 请求标头太长
- python - 用作变量时如何在win32中运行VBA宏