Java脚本,预期对象 [英] java script, object expected

查看:63
本文介绍了Java脚本,预期对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

li2.Attributes.Add("onClick", "chageClass(''" & li2.ClientID & "'');")




当我单击订单链接时,它会给出预期的错误对象,
并在查看源代码中看到以下代码.




when i click order link it give error object expected,
and see on view source following code seen.

<li id="ctl00_li2" onClick="chageClass(&#39;ctl00_li2&#39;);"><a onclick="checklist(this);" href="#">Orders</a></li>



请在主页"上帮助我这段代码.



Please help me this code on Master page.

推荐答案

如果您使用的是ASP.NET 4.0,则有一个非常简单的修复方法,只需设置控件属性
If you are working on ASP.NET 4.0 there is rather simple fix, just set the control property
ClientIDMode="Static"

和它将保留您指定的ID.唯一的例外是,当控件是数据绑定的并且需要重复时,在这种情况下,您将不得不使用

and it will retain the ID you specified. The only exception to this is when your control is databound and needs to repeat and in which case you will have to use

ClientIDMode="Predictable"


这篇关于Java脚本,预期对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆