现在的位置: 首页 > 综合 > 正文

js 获取div里的值 2种方法给父窗口控件赋值和取值

2013年05月23日 ⁄ 综合 ⁄ 共 964字 ⁄ 字号 评论关闭

1.

 

document.getElementById("divUnitInfo").innerText;//获取div里的值

document.getElementById("divUnitInfo").innerHTML+="123";//给div赋值

 

 

2.1

parent :

window.open("AddUnitInfo.aspx","x","height=400, width=400, top=200, left=200, toolbar=no, menubar=no, scrollbars=yes, resizable=no,location=n o, status=no");

 

son:

window.opener.document.getElementById("divUnitInfo").innerHTML="123";//给父窗口赋值

window.opener.document.getElementById("divUnitInfo").innerHTML;//取值

 

2.2

parent:

window.showModalDialog('AddUnitChange.aspx',window);

son:

var
 vwin 
=
 window.dialogArguments; 
//
得到window参数

var
 doc 
=
 vwin.document.getElementById(
"
TextBox1
"
).value; 
//
获得TextBox的值
,

vwin.document.getElementById(
"
TextBox1
"
).value="123";//
或赋值

 

 

 

 

===============================注意

==================================================

以上写的有些大致,不过重点都已讲到,如果有不明白请与我联系:

网站:

    http://chenhuzi.gicp.net 

QQ :

    415845188

Email:

  chen890221@126.com

MSN:  

   chenyunkun1989@hotmail.com

淘宝站:

chenhuzi.taobao.com

Mobile:

(通过以上方式获取吧!)


版权所有,转载时请注明出处,谢谢配合!!!

抱歉!评论已关闭.