• web动态添加控件


    JS:

     1 function CreateNode() {
     2     var div = document.getElementById('divMess');
     3     var Node = document.createElement("div"); //创建标签
     4     Node.innerHTML = "你好 ";
     5     Node.setAttribute("style", " 100%; float: left; height: 20px; line-height: 20px; text-align: center;");
     6     var text = document.createElement("input");
     7     text.setAttribute("type", "text");
     8     text.setAttribute("value", "");
     9     text.setAttribute("id", "txtMess");
    10     text.setAttribute("name", "mess");
    11     Node.appendChild(text);
    12     div.appendChild(Node);
    13     text.focus();
    14 }

    CS:

     1 Label lblshow;
     2 private void CreateNewContorl(string mess)
     3 {
     4     lblshow = new Label();
     5     lblshow.Text = "<br />" + mess;
     6     lblshow.Width = 150;
     7     lblshow.Height = 100;
     8     lblshow.CssClass = "Label";
     9     this.PanShowGJ.Controls.Add(lblshow);
    10 }
  • 相关阅读:
    with
    网编
    选课新系统大作业
    网络编程

    知识点
    Python
    学生选课大作业
    理解position与anchorPoint[转]
    毛玻璃效果的简单使用
  • 原文地址:https://www.cnblogs.com/chensp/p/3301250.html
Copyright © 2020-2023  润新知