我正在尝试使用以下 id 访问 MS CRM 2011 中的元素:account|NoRelationship|Form|B_GenerateInvoice-Large
我可以在 IE 开发者工具中看到这个元素:
不幸的是,当我试图找到这个元素时,我总是得到 null。
我尝试了以下方法:
alert(document.getElementById('account|NoRelationship|Form|B_GenerateInvoice-Large'));
alert($("[id='account|NoRelationship|Form|B_GenerateInvoice-Large]").html());
alert($(jq("account|NoRelationship|Form|B_GenerateInvoice-Large")).html()); // jq() adds the '#' and escapes special characters
alert($("#account|NoRelationship|Form|B_GenerateInvoice-Large").html());
alert(document.getElementById("#account\\|NoRelationship\\|Form\\|B_GenerateInvoice-Large"));
alert($("#account\\|NoRelationship\\|Form\\|B_GenerateInvoice-Large").html());
这些都找不到元素。
我在这里遗漏了一些明显的东西吗?
解决方案:
javascript 在 iframe 内,而元素在 iframe 之外。
我没有设法解决它。