我有一个COM对象,我可以使用代码在HTML页面中调用它。但是当我在带有母版页的aspx页面中使用相同的代码并将对象保留在ContentPlaceHolder标签中时,我得到错误MyObject is undefined
我的Javascript是:
<url>
<loc>xxxx/jobpage/:categoryname/:companyname/:jobtitle/:jobid</loc>
</url>
我的Html对象是
function setText()
{
txtIdCardNo.value = MyObject.getIdCard;
if (MyObject.getIdType() == "R") {
rdbCardType2.checked = true;
}
else {
rdbCardType.checked = true;
}
txtCardExpiryDate.value = MyObject.getCardexpirydate();
txtNameEnglish.value = MyObject.getNameEnglish();
txtNameArabic.value = MyObject.getNameArabic();
if (MyObject.getGender() == "M") {
rdbMale.checked = true;
} else {
rdbFemale.checked = true;
}
TxtDob.value = MyObject.getDob();
txtNationality.value = MyObject.getNationality();
txtSponsorName.value = MyObject.getSponsorEng();
txtSponsorNameArabic.value = MyObject.getSponsorArb();
txtBirthPlace.value=MyObject.getBirthPlace();
txtPassportExpiry.value = MyObject.getPassport();
txtPassportNo.value = MyObject.getPassportexp();
txtSmartCardId.value = MyObject.getSmartCard();
txtSamCardId.value = MyObject.getSAMCard();
}
答案 0 :(得分:0)
这不是问题的解决方案,而是通过使用ActiveXObject的替代路线我们可以在我们的javascript中访问COM对象,在这种情况下我们不必使用HTML对象