关于js代码重要笔记
一、新建一个对象,赋予相关属性值
var CVR_IDCard=new Object();
CVR_IDCard.CVR_IDCard='17';
alert(CVR_IDCard.CVR_IDCard);
二、利用网页文档对象,进入框架中执行js代码(主要是Iframe)
n = 窗口_取句柄_模糊 (“营业厅 - 360安全浏览器 9.1”, “360se6_Frame”)
flag = 填表.初始化 (n)
填表.网页_取网页文档对象 (n, 网页文档)
frameName = “frame_251”//可以利用对象.查看(),找到具体的子框架name
网页文档.读属性 (frameName, ).取对象 ().读对象型属性 (“document”, ).读对象型属性 (“parentWindow”, ).方法 (“execScript”, 编辑框1.内容, “JavaScript”)
三、c#中的Webcodument执行js
HtmlElement ele = webBrowser1.Document.CreateElement("script");
ele.SetAttribute("type", "text/javascript");
ele.SetAttribute("text", Properties.Resources.StringJs);
webBrowser1.Document.Body.AppendChild(ele);
四、c#中的Webcodument进入子框架
HtmlElement searchButton = webBrowser1.Document.Window.Frames["frame_25"].Document.All["cust_name"];//获取到iframe id为tgb下面的button
//点击按钮
//searchButton.InvokeMember("click");
//修改内容
searchButton.InnerText = "55555";