单页面传值

  增加自定义属性进行传值;

  JS端用getAttribute(自定义属性名)接收;

  如:<input type="button" class="shanchu" data-id="<%#Eval("ids") %>"  value="删除" />

    document.getElementsByClassName("shanchu")[0].getAttribute('data-id');

跨页面传值(get类型):    

  HTML端传值:<a href="Default.aspx?id=ids>";

  JS端传值:Window.location.href="Default.aspx?id=ids";

  C#端取值:Request["id"];

posted on 2017-12-25 00:17  我勒个去YCQ  阅读(127)  评论(0编辑  收藏  举报