要在后台改变DropdownList的背景颜色,语句如下:
Response.Write("<script>document.getElementById('ctl00_Footer_StyleDrpDwList').style.backgroundColor='#E0E0E0';</script>");
原来Page_Load中有this.SmartNavigation = true;语句,页面没有问题,去掉this.SmartNavigation = true;语句后, 访问不到DropdownList控件,JavaScript调试程序提示“缺少对象”。是C#语言做的Web.
请问有什么方法解决或者给个别的解决方法!
Response.Write("<script>document.getElementById('ctl00_Footer_StyleDrpDwList').style.backgroundColor='#E0E0E0';</script>");
原来Page_Load中有this.SmartNavigation = true;语句,页面没有问题,去掉this.SmartNavigation = true;语句后, 访问不到DropdownList控件,JavaScript调试程序提示“缺少对象”。是C#语言做的Web.
请问有什么方法解决或者给个别的解决方法!
问题已经解决,不过Page.RegisterStartupScript和Response.Write具体有什么区别?
脚本将会被放在紧挨</form>的前面。
Page.RegisterStartupScript
脚本将会被放在紧挨<form runat="server">后几个隐藏的input的后面。