如题,就是在后台为dropdownlist添加属性,然后str是个字符串,droplist.Attributes.Add("onchange", "nextdrop1(this.options[this.selectedIndex].value,str");里面那个str应该怎么写,这样写似乎不行,谢谢解答

解决方案 »

  1.   

    "str"根据你的需求定义这个参数了,给它赋值了.
      

  2.   

    本帖最后由 caozhy 于 2011-05-02 23:20:57 编辑
      

  3.   

    droplist.Attributes.Add("onchange", "nextdrop1(this.options[this.selectedIndex].value,'"+str+'");
      

  4.   

    额lz的写法多少有点儿惨不忍睹
    为droplist添加onchange事件,不管怎么说nextdrop1()的括号好歹也要是“一对”吧^_^!
    string str = "Str";
    this.dropdownlist.Attributes.Add("onchange", "nextdrop1(this.options[this.selectedIndex].value,'" + str + "')");很常用的拼接方式,可以对比一下sql语句的拼接,比较容易理解
      

  5.   


    droplist.Attributes.Add("onchange", "nextdrop1(this.options[this.selectedIndex].value,'"+str+'");