【发布时间】:2023-06-09 18:37:01
【问题描述】:
我目前正在尝试创建一个 CHM 帮助文件,用户可以在其中输入值,然后生成一个按钮以将 lPARAM 发送到 WM_TCARD。
目前,我已经在 IE 11、10、9 和 8 中进行了测试,根据 DOM Explorer 正在使用正确的参数创建对象,但它没有正确显示并且没有显示为按钮。
<body>
<button onclick="create_object();">Try it</button>
<input type="text" id="layout_enter" />
<button id=click_button99 onclick="click_new_object();">click</button>
<script>
function create_object() {
var new_obj = document.createElement("OBJECT");
new_obj.setAttribute("classid", "clsid:41B23C28-488E-4E5C-ACE2-BB0BBABE99E8");
new_obj.setAttribute("codebase", "HHCTRL.ocx#Version=4,72,8252,0");
new_obj.setAttribute("type", "application/x-oleobject");
new_obj.setAttribute("id", "object99");
document.body.appendChild(new_obj);
var layout_entered = "10," +
document.getElementById('layout_enter').value
var z = document.createElement("PARAM");
z.setAttribute("name", "Button");
z.setAttribute("value", "PP Sonic");
document.getElementById("object99").appendChild(z);
var y = document.createElement("PARAM");
y.setAttribute("name", "Command");
y.setAttribute("value", "TCard");
document.getElementById("object99").appendChild(y);
var x = document.createElement("PARAM");
x.setAttribute("name", "Image");
x.setAttribute("value", " ");
document.getElementById("object99").appendChild(x);
var w = document.createElement("PARAM");
w.setAttribute("name", "Item1");
w.setAttribute("value", layout_entered);
document.getElementById("object99").appendChild(w);
var v = document.createElement("PARAM");
v.setAttribute("name", "UseButton");
v.setAttribute("value", "TRUE");
document.getElementById("object99").appendChild(v);
var u = document.createElement("PARAM");
u.setAttribute("name", "UseIcon");
u.setAttribute("value", "TRUE");
document.getElementById("object99").appendChild(u);
}
function click_new_object() {
document.getElementById("object99").click();
}
</script>
</body>
任何帮助/建议将不胜感激。 我已经查看了 ActiveX 的 Internet 选项中的安全选项,但没有解决任何问题。如果我已经在代码中存在对象,那么它就会出现。让我觉得这不是对象的问题,而是创作的问题。
请注意:我不能使用 JQuery。
谢谢。
【问题讨论】:
标签: javascript html object chm createelement