易截截图软件、单文件、免安装、纯绿色、仅160KB

如何用JavaScript找到 用JavaScript动态添加的控件

用JavaScript在页面添加了一个按钮,可以再页面看到,
但是用JavaScript.getelementById找不到,
查看页面源代码也找不到
请问有什么找到的办法吗
谢谢
用JavaScript动态添加的控件查看页面源代码当然找不到到啦
用JavaScript.getelementById找不到的话你在用JavaScript动态添加的控件时有没有指定按钮的Id属性呢?

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title> </title>
  <script type="text/javascript">
      var i = 0;
      function aa() {
          i++;
          txt = document.createElement("input");
          txt.type = "text";
          txt.id = "aa" + i;
          txt.setAttribute("onclick", "aa()");
          div1.appendChild(txt);
      }
      function Button2_onclick() {
          var aaa = document.getElementById("aa2").value;
          alert(aaa);
      }

  </script>
</head>
<body id="aaaa">
    <form id=


相关问答:

javascript调用后台带参数的函数

后台有一个函数 protected string Fun1(int a, string b)

我想在javascript代码中调用它,怎么做?

function GridBind()
{
    var a = 1;
    var b='s';
& ......

javascript如何调用asp.net带参数的函数

后台:
  protected void form_ini2(string id)
  {
  //处理代码
  }
前台:
 <script language="javascript">
 function DbClickEvent(a ......

如何用javascript在页面中动态更新某一块的内容?

我的源文件如下:
<html>
<head> <title>show picture </title>
<script>
function change(fileName)
    {
     
    ......

这段JavaScript代码为什么无法执行 - .NET技术 / C#

以下是一段JavsScript脚本,但运行时总会产生 “Microsoft JScript 运行时错误: 'null' 为空或不是对象”异常,大家帮看一下。 
<form id="form1" runat="server">
  < ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号