本网站:http: //blog.joins.com/media/folderListSlide.asp?uid = ddatk&folder = 3&list_id = 9960150
有这个代码:
<script>alert('¿Ã¹Ù¸¥ Çü½ÄÀÌ ¾Æ´Õ´Ï´Ù.');</script>
Run Code Online (Sandbox Code Playgroud)
所以我的网页浏览器控件显示弹出窗口,如何在不使用sendkeys输入的情况下绕过弹出窗口?
我已将winforms html 编辑器中的代码改编为 C#(见下文)。是否可以使用 CKEditor 代替?
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WebEditorTest
{
/// <summary>
/// /sf/ask/14988711/
/// </summary>
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
webBrowser1.Navigate("about:blank");
Application.DoEvents();
webBrowser1.Document.OpenNew(false).Write("<html><body><div id=\"editable\">Edit this text</div></body></html>");
foreach (HtmlElement el in webBrowser1.Document.All)
{
el.SetAttribute("unselectable", "on");
el.SetAttribute("contenteditable", "false");
}
foreach (HtmlElement el in webBrowser1.Document.All.GetElementsByName("editable"))
{
el.SetAttribute("width", webBrowser1.Width + "px");
el.SetAttribute("height", …Run Code Online (Sandbox Code Playgroud) 这里有关于Windows窗体的很棒的教程
我尝试过它,效果很好
但问题是在wpf应用程序中无法识别所使用的对象.所以我要问的是wpf应用程序中下面函数的等价物.谢谢.
HtmlElement head = webBrowser1.Document.GetElementsByTagName("head")[0];
HtmlElement scriptEl = webBrowser1.Document.CreateElement("script");
IHTMLScriptElement element = (IHTMLScriptElement)scriptEl.DomElement;
string srJquery = File.ReadAllText("jquery.txt");
element.text = srJquery;
head.AppendChild(scriptEl);
Run Code Online (Sandbox Code Playgroud)
上面的函数在Windows窗体应用程序c#4.0中完美地工作,但在WPF应用程序中无法识别使用的对象,如HtmlElement.
我正在开发 Windows Phone 7.1 PhoneGap 应用程序。我想删除由window.localStorage.setItemC# 中的 JavaScript 代码创建的本地存储。我知道,在 JavaScript 中我们可以删除使用 window.localStorage.removeItem. 但是,我想从 C# 背后的代码中删除。任何帮助表示赞赏。