Javascript formAction跨浏览器的奇怪设置值
类元素输入的formAction属性由IE10+、FF、Chrome。。。由于某种原因,我将其重置为空:Javascript formAction跨浏览器的奇怪设置值,javascript,html,browser,Javascript,Html,Browser,类元素输入的formAction属性由IE10+、FF、Chrome。。。由于某种原因,我将其重置为空: // in html <input id="aa" type="submit" /> // in script var aa = document.getElementById("aa"); console.log(aa.formAction); // "" aa.formAction = null; console.log(aa.formAction); //"null" in
// in html
<input id="aa" type="submit" />
// in script
var aa = document.getElementById("aa");
console.log(aa.formAction); // ""
aa.formAction = null;
console.log(aa.formAction);
//"null" in IE10
// "" in Chrome
// "http://currentdomain/currentfolder/null" in Firefox
//在html中
//手稿
var aa=document.getElementById(“aa”);
console.log(aa.formAction);//""
aa.formAction=null;
控制台日志(aa.形式);
//IE10中的“null”
//”“是铬的
// "http://currentdomain/currentfolder/null“在Firefox中
chrome似乎将空值重置为空字符串,Firefox和IE只是将其更改为字符串(而Firefox记住它应该是一个url)。
此外,如果将其值设置为“null”,chrome将返回与Firefox相同的结果。你的问题是什么?你为什么要从输入字段中获取
formAction
属性值?@musefan在这里发布作为标记,我想知道dom属性中的get和set之间是否还有其他不同的值browsers@jamesli:那么你没有问题了吗?@KristianVitozev在项目代码中,我们使用了一个多选项卡表单,它要么提交到默认操作URL,要么在用户切换选项卡时阻止并执行一些ajax句柄。所以获取它的值就像检查当前逻辑一样。