错误

1、window.showModalDialog is not a function     

解决办法:换成window.open    因为在chorme 37以后,谷歌就已经把这个函数停用了。IE还可以用.......

但是我现在还是不知道window.open 如何获取子窗口的值返回给父窗口,所以只好乖乖用IE,其他的浏览器好像都不可以 。。 

window.showModalDialog 可以非常方便的获取子窗口的返回值   window.returnValue

不知道为什么其他浏览器不支持showModalDialog ,明明很方便啊...

dev.opera.com/blog/...    参考这个网站,原来Chrome不支持它的原因是 不安全等。


好啦  那就用window.open吧

怎么用呢?   参考这个--->  window.open使用说明   就很容易明白啦

也就是说,可以在子窗口的<script></script>中写个方法,例如:通过ID获取的元素是父窗口中的页面元素,这样就实现了对父窗口中的相应控件进行赋值,也就是子窗口往父窗口中返回值。

<script type="text/javascript">
function selectInfo(name) {
    //window.opener.window.returnValue =name;
    //window.returnValue = name;
    //window.opener.window.document.getElementById("txtGuestName")
    window.opener.document.getElementById("txtGuestName").value = name.toString().split(',')[0];
    window.opener.document.getElementById("txtManName").value = name.toString().split(',')[1];
    window.opener.document.getElementById("txtPhone").value = name.toString().split(',')[2];
    window.opener.document.getElementById("txtAddress").value = name.toString().split(',')[3];
    window.opener.document.getElementById("txtcomitype").value = name.toString().split(',')[4];
    window.opener.document.getElementById("txtBrand").value = name.toString().split(',')[5];
    window.opener.document.getElementById("txtSpeci").value = name.toString().split(',')[6];
    window.opener.document.getElementById("txtDispTime").value = name.toString().split(',')[7];
    window.opener.document.getElementById("txtnumber").value = name.toString().split(',')[8];
    window.opener.document.getElementById("txtTotalPractical").value = name.toString().split(',')[9];
    window.opener.document.getElementById("txtSalesCode").value = name.toString().split(',')[10];
    
        window.close();
}
</script>

//代码注释:name是一个用字符串,以防万一。。再toString()一下。

以下的代码是windows.showModalDialog方法  获取子窗口的返回值,把返回值传递给父窗口,用一个变量接收,再获取页面元素来进行赋值。 

window.opener.window.returnValue =name;

总结一下windows.open和windows.showModalDialog区别:都可以对父窗口中元素进行赋值,代码的位置不一样而已,一个是在子窗口的script中,一个是在父窗口的script中。现在最好用windows.open~~~


2、result.split is not a function

解决办法:

可能得到的result不是一个字符串。可以用 result.ToString().split(',')[0]  来获取。

还可能是有其他的问题,好好检查一下。

3、如果只想获取数据库中datetime类型的一部分,如只获取年月日

convert(char(10),Storagedate,120) AS storDate
其中的
Storagedate  
和 storDate  都是自己命名的,可以随意变

4、天下无难事,只怕有心人。

有error是好事~~~

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值