如何取得IE窗口?
===file1.htm===
<html>
<head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>在右边打开一个网页</title>
<script language ="javascript" type ="text/javascript">
<!--
function clickcode(){
alert("OK");
showModalDialog("file2.htm",window,"dialogtop=10px;dialogleft=30px");
}
-->
</script>
</head>
<body>
<input id = "button" type ="button" onclick = "clickcode" value = "打开一个窗口">
</body>
</html>
===file2.htm===
<html>
<head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>弹出窗口</title>
</head>
<body>
<p><input id="text" type="text" name="T1" size="20"></p>
</body>
</html>
===C#代码===
private void LoadFile1()
{
webBrowser1.Navigate("file1.htm");
HtmlElement he = webBrowser1.Document.GetElementById("button");
he.InvokeMember("click");
}
些处会弹出一个加载了file2.htm的窗口
···请问我要写一个函数读取这个窗口中的网页元素id="text"的文本框中的内容该如何写?
private void ReadFile2()
{
//1. 如何得到通过WebBroser控件弹出的那个窗口句柄(handleWin)?
//2. 如何通过handleWin得到其中的网页对象?
//3. 如何通过得到的网页对象读取、操作网页中的元素?
}
---每问30分