當前位置: 首頁>>代碼示例>>C#>>正文


C# HtmlElement.SetAttribute方法代碼示例

本文整理匯總了C#中System.Windows.Forms.HtmlElement.SetAttribute方法的典型用法代碼示例。如果您正苦於以下問題:C# HtmlElement.SetAttribute方法的具體用法?C# HtmlElement.SetAttribute怎麽用?C# HtmlElement.SetAttribute使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Windows.Forms.HtmlElement的用法示例。


在下文中一共展示了HtmlElement.SetAttribute方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: SetValue

 public override void SetValue(HtmlElement element)
 {
     // 如果checkbox的有屬性是“checked”它將被檢查。
     if (Checked)
     {
         element.SetAttribute("checked", "checked");
     }
     else
     {
         element.SetAttribute("checked", null);
     }
 }
開發者ID:zealoussnow,項目名稱:OneCode,代碼行數:12,代碼來源:HtmlCheckBox.cs

示例2: SetElementValue

 public static void SetElementValue(HtmlElement htmlElement, string value)
 {
     if (htmlElement != null)
     {
         htmlElement.SetAttribute("value", value);
     }
 }
開發者ID:340211173,項目名稱:hf-2011,代碼行數:7,代碼來源:CommUitl.cs

示例3: set

 public void set(HtmlElement elm, string value)
 {
     if (elm == null)
         return;
     elm.SetAttribute("value", value);
     SimpleDocument.fireChange(elm);
 }
開發者ID:waitingzeng,項目名稱:ttwait-code,代碼行數:7,代碼來源:SimpleDocument.cs

示例4: _SetItemSelected

 private static HtmlElement _SetItemSelected(HtmlElement el)
 {
     if (el != null)
         el.SetAttribute("className", "report selected");
     return el;
 }
開發者ID:TalasZh,項目名稱:opencbs,代碼行數:6,代碼來源:ReportBrowserControl.cs

示例5: SetItemUnselected

 private static void SetItemUnselected(HtmlElement el)
 {
     if (el != null)
         el.SetAttribute("className", "report");
 }
開發者ID:TalasZh,項目名稱:opencbs,代碼行數:5,代碼來源:ReportBrowserControl.cs

示例6: BtnTest0

 private void BtnTest0(HtmlElement link)
 {
     string orig_class = (string)link.GetAttribute("className");
     if (orig_class.Contains("directjob_test"))
     {
         string ss = orig_class.Replace(" directjob_test", "");
         link.SetAttribute("className", ss);
         //MessageBox.Show(link.GetAttribute("className"));
     }
 }
開發者ID:J2cx,項目名稱:directjob4,代碼行數:10,代碼來源:DirectJobForm.cs

示例7: CheckElement

        private void CheckElement(HtmlElement ele)
        {
            if (ele != null && ele != hoveringElement)
            {
                if (hoveringElement != null)
                {
                    try
                    {
                        hoveringElement.Style = hoveringElement.GetAttribute("OldStyle");
                    }
                    catch { }
                }

                ele.SetAttribute("OldStyle", ele.Style);
                ele.Style = ele.Style + ";border:solid 1px red;";

                hoveringElement = ele;
            }
        }
開發者ID:EricBlack,項目名稱:web-automation,代碼行數:19,代碼來源:Main.cs

示例8: setCheckValue

		private void setCheckValue (HtmlElement el, bool check)
		{
			if (check)
				el.SetAttribute("checked", "checked");
			else
				el.SetAttribute("checked", "");
		}
開發者ID:rhoney,項目名稱:jsBeautifier.net,代碼行數:7,代碼來源:JsBeautifier.cs

示例9: SetCheckRadioBox

 public void SetCheckRadioBox(HtmlElement elem, bool val)
 {
     elem.SetAttribute("checked", val ? "true" : "false");
 }
開發者ID:Alister742,項目名稱:ParseKit,代碼行數:4,代碼來源:BrowserBot.cs

示例10: SetHtmlElementValue

 public static void SetHtmlElementValue(HtmlElement he, string value)
 {
     LoggingService.DebugFormatted("將設置{0}-{1}的值:{2}", new object[] { he.Document.Url.ToString(), he.Id, value });
     he.SetAttribute("value", value);
     if (he.TagName.ToLower() == "select")
     {
         string attribute = he.GetAttribute("valuechange");
         if ((attribute != null) && (attribute.Length > 0))
         {
             he.Document.InvokeScript(attribute, new string[] { value });
         }
     }
 }
開發者ID:vanloc0301,項目名稱:mychongchong,代碼行數:13,代碼來源:WebBrowserExtensions.cs

示例11: SelectResult

		private void SelectResult(int id)
		{
			if(m_hilightedElement != null)
				m_hilightedElement.SetAttribute("className", "result");

			m_hilightedElement = outputBrowser.Document.GetElementById(id.ToString());

			if (m_hilightedElement != null)
			{
				m_hilightedElement.SetAttribute("className", "result hilight");
				int bufferHeight = m_hilightedElement.OffsetRectangle.Height * 3;
				Rectangle viewRect = new Rectangle(
					outputBrowser.Document.Body.ScrollLeft, 
					outputBrowser.Document.Body.ScrollTop + bufferHeight, 
					outputBrowser.Document.Body.ClientRectangle.Width,
					outputBrowser.Document.Body.ClientRectangle.Height - bufferHeight * 2);
				if (!viewRect.IntersectsWith(m_hilightedElement.OffsetRectangle))
				{
					if (m_hilightedElement.OffsetRectangle.Top < viewRect.Top)
						outputBrowser.Document.Body.ScrollTop = Math.Max(0, m_hilightedElement.OffsetRectangle.Top - bufferHeight);
					else
						outputBrowser.Document.Body.ScrollTop = Math.Min(outputBrowser.Document.Body.ScrollRectangle.Height, m_hilightedElement.OffsetRectangle.Bottom - outputBrowser.Document.Body.ClientRectangle.Height + bufferHeight);
				}
			}
		}
開發者ID:zcnet4,項目名稱:lua-tilde,代碼行數:25,代碼來源:FindResultsPanel.cs

示例12: BtnTest1

        private void BtnTest1(HtmlElement link)
        {
            string orig_class = (string)link.GetAttribute("className");

            link.SetAttribute("className", orig_class + " " + "directjob_test");
            //link.Focus();
            //MessageBox.Show(link.GetAttribute("classname").ToString());
            IHTMLElement myele = (IHTMLElement)link.DomElement;
            IHTMLDOMNode n1 = (IHTMLDOMNode)myele;

            //MessageBox.Show(n1.nodeName);
            IHTMLAttributeCollection attrcol = (IHTMLAttributeCollection)n1.attributes;

            treeView1.Nodes.Add(myele.tagName);
            treeView1.Nodes[treeView1.Nodes.Count - 1].Nodes.Add("Attributes");
            if (attrcol != null)
                foreach (IHTMLDOMAttribute iatt1 in attrcol)
                {
                    if (iatt1.nodeValue != null && (iatt1.nodeValue.ToString() != "") && myele.outerHTML.Contains(iatt1.nodeName))
                    //MessageBox.Show("att1 name : "+iatt1.nodeName +"\natt1 value : "+ iatt1.nodeValue.ToString());
                    {
                        //MessageBox.Show("att1 name : " + iatt1.nodeName + "\natt1 value : " + iatt1.nodeValue.ToString());
                        treeView1.Nodes[treeView1.Nodes.Count - 1].Nodes[0].Nodes.Add(iatt1.nodeName, iatt1.nodeName + "=" + iatt1.nodeValue.ToString());
                        treeView1.Nodes[treeView1.Nodes.Count - 1].Nodes[0].LastNode.ToolTipText = iatt1.nodeValue.ToString();
                    }
                }
            if (myele.style.cssText != null && myele.style.cssText.Length > 0)
            {
                treeView1.Nodes[treeView1.Nodes.Count - 1].Nodes.Add("style", "sytle=" + myele.style.cssText);
                treeView1.Nodes[treeView1.Nodes.Count - 1].LastNode.ToolTipText = myele.style.cssText;
            }
            if (myele.outerText != null && myele.outerText.Length > 0)
            {
                treeView1.Nodes[treeView1.Nodes.Count - 1].Nodes.Add("outerText", "outerText=" + myele.outerText);
                treeView1.Nodes[treeView1.Nodes.Count - 1].LastNode.ToolTipText = myele.outerText;
            }
            if (myele.outerHTML != null && myele.outerHTML.ToString().Length > 0)
            {
                treeView1.Nodes[treeView1.Nodes.Count - 1].Nodes.Add("outerHTML", "outerHTML=" + myele.outerHTML.ToString());
                treeView1.Nodes[treeView1.Nodes.Count - 1].LastNode.ToolTipText = myele.outerHTML.ToString();
            }
        }
開發者ID:J2cx,項目名稱:directjob4,代碼行數:42,代碼來源:DirectJobForm.cs

示例13: vl1f

 //Insert values
 public void vl1f()
 {
     hElement1 = webBrowser1.Document.GetElementById(textBoxJSLogin.Text);
     hElement1.SetAttribute("value", textBoxBrowserLogin.Text);
     hElement2 = webBrowser1.Document.GetElementById(textBoxJSPass.Text);
     hElement2.SetAttribute("value", textBoxBrowserPassword.Text);
     hElement3 = webBrowser1.Document.GetElementById(textBoxJSForm.Text);
     hElement3.InvokeMember(textBoxJSSubmit.Text);
 }
開發者ID:salih18200,項目名稱:orcs,代碼行數:10,代碼來源:Calendar.cs

示例14: SetComboBoxValue

 public void SetComboBoxValue(HtmlElement elem, string val)
 {
     elem.SetAttribute("selectedIndex", val);
 }
開發者ID:Alister742,項目名稱:ParseKit,代碼行數:4,代碼來源:BrowserBot.cs

示例15: SetValue

 public override void SetValue(HtmlElement element)
 {
     element.SetAttribute("value", Value);
 }
開發者ID:zealoussnow,項目名稱:OneCode,代碼行數:4,代碼來源:HtmlPassword.cs


注:本文中的System.Windows.Forms.HtmlElement.SetAttribute方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。