所有,我想在jsp 页面中使用javascript创建html obejct,但'alert(GameObject1.loginurl);'将提醒'未定义'。如何在jsp页面中使用javascript创建html obejct
我在下面的代码中发现了一些错误吗? 看来'obj.appendChild'失败了。但是为什么?
var obj;
try {
obj = document.createElement("object");
obj.id = "GameObject1";
obj.name = "JavaGameObject1";
obj.setAttribute("classid", "clsid:72E6F181-D1B0-4C22-B0D7-4A0740EEAEF5");
obj.width = 640;
obj.height = 526;
var loginurl = document.createElement("param");
loginurl.setAttribute("name", "loginurl");
loginurl.setAttribute("value", "xx.xx.xx.xx:8080");
obj.appendChild(loginurl);
document.body.appendChild(obj);
alert(GameObject1.loginurl);
} catch (e) {
alert("Exception:" + e.message);
}
你期待从'GameObject1.loginurl'得到什么? – Musa 2013-04-28 06:47:12