CRM2011:保存表单时 Silverlight 未触发,出现 JavaScript 错误:SCRIPT16389
我在表单上有一个silverlight webresource,在表单onload事件中,我使用javascript来调用silverlight中的方法。
当打开表单或单击刷新表单时,将触发 silverlight 方法,这是正确的。
但是,如果更新记录并单击“保存”,表单会重新加载,但 silverlight 不会触发,我收到此 javascript 错误:
Microsoft JScript 运行时错误: SCRIPT16389
这是我调用 silverlight 的 javascript 函数:
function Test() {
debugger;
var sl1 = document.getElementById('WebResource_SLTextBox'); //the weresource was put on the form already
sl1.Content.scriptableLable.TestAlert(); //the silverlight only do one thing which is pop up a message box. here got javascript error
}
我添加了一个 javascript 警报用于测试目的,它使其工作!单击警报框中的“确定”按钮后,将触发 silverlight 方法。
问题是我无法在页面上留下此警报。它仅用于测试,但如果我删除警报,则 silverlight 不会被触发。 :(
I have a silverlight webresource on the form, in the form onload event, I use javascript to call the method in the silverlight.
When open a form or click refresh the form, the silverlight method be fired which is correct.
But if update the record and click save, the form reload but the silverlight not fired, I got this javascript error:
Microsoft JScript runtime error:
SCRIPT16389
This is my javascript function to call silverlight:
function Test() {
debugger;
var sl1 = document.getElementById('WebResource_SLTextBox'); //the weresource was put on the form already
sl1.Content.scriptableLable.TestAlert(); //the silverlight only do one thing which is pop up a message box. here got javascript error
}
I add a javascript alert for test purpose and it make it works! After click the "OK" button on the alert box, the silverlight method fired.
The problem is I can't leave this alert on the page. It only for testing, but if I remove the alert, the silverlight not fired. :(
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我修改我的代码,在 silverlight 控件加载事件中调用 silverlight 方法,而不是从表单 onload javascript 调用它。
这个方法奏效了。
I modify my code, call the silverlight method in silverlight control loaded event instead of call it from form onload javascript.
This way worked.