本文整理汇总了C#中System.Windows.Forms.HtmlDocument.CreateElement方法的典型用法代码示例。如果您正苦于以下问题:C# HtmlDocument.CreateElement方法的具体用法?C# HtmlDocument.CreateElement怎么用?C# HtmlDocument.CreateElement使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.HtmlDocument
的用法示例。
在下文中一共展示了HtmlDocument.CreateElement方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: JQ
public void JQ(HtmlDocument HD)
{
HtmlElement HE = HD.CreateElement("SCRIPT");
HE.SetAttribute("src", "https://code.jquery.com/jquery-1.11.1.min.js");
HD.Body.AppendChild(HE);
HtmlElement HE2 = HD.CreateElement("SCRIPT");
HE2.SetAttribute("text", Properties.Resources.attrNodeTopLeft);
HD.Body.AppendChild(HE2);
HD.InvokeScript("attrNodeTopLeft");
}
示例2: GetScript
private HtmlElement GetScript(HtmlDocument pDoc)
{
HtmlElement script;
script = pDoc.CreateElement("script");
script.SetAttribute("id", "CUITe_Script");
script.SetAttribute("type", "text/javascript");
script.SetAttribute("text", @"
var isCodeLanguageVB = " + isCodeLanguageVB.ToString().ToLowerInvariant() + @";
var oStyle;
var sCode;
var sOutHtml;
var sFilter;
var objInQuestion;
var vTempCounter = 0;
/**
* http://www.javascripttoolbox.com/lib/objectposition/source.php
* Copyright (c)2005-2009 Matt Kruse (javascripttoolbox.com)
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* 'Software'), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*/
var Position = (function() {
// Resolve a string identifier to an object
// ========================================
function resolveObject(s) {
if (document.getElementById && document.getElementById(s) != null) {
return document.getElementById(s);
}
else if (document.all && document.all[s] != null) {
return document.all[s];
}
else if (document.anchors && document.anchors.length && document.anchors.length > 0 && document.anchors[0].x) {
for (var i = 0; i < document.anchors.length; i++) {
if (document.anchors[i].name == s) {
return document.anchors[i]
}
}
}
}
var pos = {};
pos.$VERSION = 1.0;
// Set the position of an object
// =============================
pos.set = function(o, left, top) {
if (typeof(o) == 'string') {
o = resolveObject(o);
}
if (o == null || !o.style) {
return false;
}
// If the second parameter is an object, it is assumed to be the result of getPosition()
if (typeof(left) == 'object') {
var pos = left;
left = pos.left;
top = pos.top;
}
o.style.left = left + 'px';
o.style.top = top + 'px';
o.style.width = pos.width;
o.style.height = pos.height;
return true;
};
// Retrieve the position and size of an object
// ===========================================
pos.get = function(o) {
var fixBrowserQuirks = true;
// If a string is passed in instead of an object ref, resolve it
if (typeof(o) == 'string') {
o = resolveObject(o);
}
if (o == null) {
return null;
}
var left = 0;
var top = 0;
var width = 0;
//.........这里部分代码省略.........
示例3: webLogs_DocumentCompleted
void webLogs_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
logDoc = webLogs.Document;
logDocRaw = (IHTMLDocument2)logDoc.DomDocument;
IHTMLStyleSheet ss = logDocRaw.createStyleSheet("", 0);
ss.cssText = Properties.Resources.defaultTemplate;
var myScript = logDoc.CreateElement("script");
((IHTMLScriptElement)myScript.DomElement).text = Properties.Resources.hoverJavaScript;
// logDoc.Body.AppendChild(myStyle);
logDoc.Body.AppendChild(myScript);
Debug.WriteLine(logDoc.Body.InnerHtml);
}