下面是一个浏览器,实现到HTTP://onlinefamily.norton.com 那里自动填写不准浏览的网站,请帮我看看哪里错了,按了BUTTON没反应,我是VS 2005using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;namespace autofillform
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }        private void Form1_Load(object sender, EventArgs e)
        {
            webBrowser1.Navigate("http://onlinefamily.norton.com");
        }        private void button1_Click(object sender, EventArgs e)
        {
            HtmlElement element = webBrowser1.Document.GetElementById("newBlockUrl");
            element.SetAttribute("value", "WWW.163.COM");
            webBrowser1.Document.All["blockListBtn"].InvokeMember("Click");        }
    }
}http://onlinefamily.norton.com 设置的屏蔽网站的HTML
<label for="newBlockUrl" class="" style="text-align: left; padding-left: 10px; width: 100%; padding-bottom: 6px;">输入网站</label>
<input class="fs_inpleft" id="newBlockUrl" name="newBlockUrl" autocomplete="off" style="width: 240px;" maxlength="100" type="text"><button id="blockListBtn" type="button" class="btn-yellow-small" onclick="thisPage.addToBlockList(); return false;" style="float: right; margin-right: 10px;">

解决方案 »

  1.   

    重新在界面上双击 Button 让它自动产生后台事件
      

  2.   

    后台没控件
    但是网页是fs,用https
      

  3.   

    点击button时确保webbrowser已经加载完毕,没反应看看能否触发button的click,如果不触发就是没有关联上事件
      

  4.   

    就是没有触发,那个TEXT输入控件也没有输入网址,请问这是什么回事?
    我后来修改了  private void button1_Click(object sender, EventArgs e)
            {
                HtmlElement element = webBrowser1.Document.GetElementById("newBlockUrl");
                element.InnerText="113.105.246.90";
                HtmlElement submit = webBrowser1.Document.GetElementById("blockListBtn");
                submit.InvokeMember("click");        }
    那个网页的HTML <label for="newBlockUrl" class="" style="text-align: left; padding-left: 10px; width: 100%; padding-bottom: 6px;">输入网站</label>

    <div style="clear: both; padding-bottom: 0px;">
    <div class="fs_inp">
    <div class="fs_inpright">
    <input class="fs_inpleft" id="newBlockUrl" name="newBlockUrl" autocomplete="off" style="width: 240px;" maxlength="100" type="text">
    </div>
    </div>
    <span style="display: none;" class=" error" id="newBlockUrl_error"></span> </div>

    <span id="newBlockUrl_msg" style="float: right; color: red; padding: 5px 20px 0pt 11px;">&nbsp;</span>
    <div id="blockListButton" style="float: right; clear: both; margin-top: 10px; width: 100%;">
    <img src="SettingsHome.fs2_files/icon-help_002.gif" alt="" style="cursor: help; float: right; padding-top: 3px; margin-right: 15px;" id="help_tooltip_BlockUrl" class="ttNode">
    <button id="blockListBtn" type="button" class="btn-yellow-small" onclick="thisPage.addToBlockList(); return false;" style="float: right; margin-right: 10px;">
    <span><b>添加到列表</b></span>
    </button>
      

  5.   

    可能由于网页是加密的https 所以无效http://topic.csdn.net/u/20100803/06/091ac339-1d31-4e68-b201-76c7554e494c.html