• js模态窗口返回值(table)


    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>无标题文档</title>
    <script type="text/javascript">
    function btnOpen_Click()
    {
    var obj=window.showModalDialog("Noname2.html",window);
    document.getElementById("brandId").value=obj[0];
    document.getElementById("brandName").value=obj[1];
    alert(obj[0]);
    alert(obj[1]);
    }
    </script>
    </head>

    <body>

    <input id="brandId" type="hidden" name="brandId" value="" style="80"/>
    <input id="brandName" type="text" name="brandName" value="" style="80" onclick="btnOpen_Click();" />
    <br/>
    </body>
    </html>

    -----Noname2.html

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>无标题文档</title>
    <script type="text/javascript">

    /*function test(obj){
    var td1 = obj.firstElementChild.firstChild.value;
    var td2=obj.lastElementChild.firstChild.value;
    var array=new Array();
    array.push(td1);
    array.push(td2);
    window.returnValue=array;
    window.close();
    }*/

    function test(obj){
    var td1 = obj.firstElementChild.firstChild.innerHTML;
    var td2=obj.lastElementChild.firstChild.innerHTML;
    var array=new Array();
    array.push(td1);
    array.push(td2);
    window.returnValue=array;
    window.close();
    }

    </script>
    </head>

    <body > 

    <!--form name = "Form2">
    <input type = "button" value="Click" name = "btnOpen" onClick="btnOpen_Click();" />
    <input id="bbbbb" type = "text" name = "txtValue" />
    </form-->
    <!--table border="1" id="table">
    <tr>
    <td><input name="" id="" value="序号" /></td>
    <td><input name="" id="" value="数量" /></td>
    </tr>
    <tr ondblclick="test(this)" id="1">
    <td><input name="" id="" value="1" /></td>
    <td><input name="" id="" value="2" /></td>
    </tr>
    <tr ondblclick="test(this)" id="2">
    <td><input name="" id="" value="3" /></td>
    <td><input name="" id="" value="4" /></td>
    </tr>
    <tr ondblclick="test(this)" id="3">
    <td><input name="" id="" value="5" /></td>
    <td><input name="" id="" value="6" /></td>
    </tr>
    </table-->


    <table border="1" id="table">
    <tr>
    <td><input name="" id="" value="序号" /></td>
    <td><input name="" id="" value="数量" /></td>
    </tr>
    <tr ondblclick="test(this)" id="1">
    <td><div>1</div></td>
    <td><div>2</div></td>
    </tr>
    <tr ondblclick="test(this)" id="2">
    <td><div>3</div></td>
    <td><div>4</div></td>
    </tr>
    <tr ondblclick="test(this)" id="3">
    <td><div>5</div></td>
    <td><div>6</div></td>
    </tr>
    </table>
    </body>
    </html>

  • 相关阅读:
    json2.js和wcf传递Date对象问题
    使用WebClient发送POST请求
    我也质疑下petshop
    sql server 2005 游标使用小例
    关于SCOPE_IDENTITY、IDENT_CURRENT 和 @@IDENTITY
    小错误大麻烦
    SQL Server启动出现“指定的服务未安装”的解决方法
    非常不错的一个网站
    objectdatasource 未能找到带参数的非泛型方法
    SQLServer日志文件收缩
  • 原文地址:https://www.cnblogs.com/lanliying/p/3988944.html
Copyright © 2020-2023  润新知