熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> .NET編程 >> 正文

ASP.net中用axWebBrowser中提交表單

2013-11-13 10:31:21  來源: .NET編程 

  <TR bgColor=#ffffff width=%>
  <TD align=middle colSpan=>
  <form id=form>
  <INPUT language=JavaScript class=button id=Btton onclick=if (typeof(Page_ClientValidate) == function) Page_ClientValidate(); type=submit value=Start onclick=alert(dd) name=Btton></TD></TR>
  </form>
  
  
  <input type=button onclick=alert(test) id=button>
  
  
  
  formcs
  
  
  using System;
  using SystemDrawing;
  using SystemCollections;
  using SystemComponentModel;
  using SystemWindowsForms;
  using SystemData;
  using mshtml;
  
  
  namespace WindowSAPplication
  {
  /// <summary>
  /// Form 的摘要說明
  /// </summary>
  public class Form : SystemWindowsFormsForm
  {
  private AxSHDocVwAxWebBrowser axWebBrowser;
  private SystemWindowsFormsButton button;
  private SystemWindowsFormsButton button;
  /// <summary>
  /// 必需的設計器變量
  /// </summary>
  private SystemComponentModelContainer components = null;
  
  
  public Form()
  {
  //
  // Windows 窗體設計器支持所必需的
  //
  InitializeComponent();
  
  
  //
  // TODO: 在 InitializeComponent 調用後添加任何構造函數代碼
  //
  }
  
  
  /// <summary>
  /// 清理所有正在使用的資源
  /// </summary>
  protected override void Dispose( bool disposing )
  {
  if( disposing )
  {
  if (components != null)
  {
  componentsDispose();
  }
  }
  baseDispose( disposing );
  }
  

  #region Windows 窗體設計器生成的代碼
  /// <summary>
  /// 設計器支持所需的方法 不要使用代碼編輯器修改
  /// 此方法的內容
  /// </summary>
  private void InitializeComponent()
  {
  SystemResourcesResourceManager resources = new SystemResourcesResourceManager(typeof(Form));
  thisaxWebBrowser = new AxSHDocVwAxWebBrowser();
  thisbutton = new SystemWindowsFormsButton();
  thisbutton = new SystemWindowsFormsButton();
  ((SystemComponentModelISupportInitialize)(thisaxWebBrowser))BeginInit();
  thisSuspendLayout();
  //
  // axWebBrowser
  //
  thisaxWebBrowserEnabled = true;
  thisaxWebBrowserLocation = new SystemDrawingPoint( );
  thisaxWebBrowserOcxState = ((SystemWindowsFormsAxHostState)(resourcesGetObject(axWebBrowserOcxState)));
  thisaxWebBrowserSize = new SystemDrawingSize( );
  thisaxWebBrowserTabIndex = ;
  //
  // button
  //
  thisbuttonLocation = new SystemDrawingPoint( );
  thisbuttonName = button;
  thisbuttonSize = new SystemDrawingSize( );
  thisbuttonTabIndex = ;
  thisbuttonText = button;
  thisbuttonClick += new SystemEventHandler(thisbutton_Click);
  //
  // button
  //
  thisbuttonLocation = new SystemDrawingPoint( );
  thisbuttonName = button;
  thisbuttonTabIndex = ;
  thisbuttonText = button;
  thisbuttonClick += new SystemEventHandler(thisbutton_Click);
  //
  // Form
  //
  thisAutoScaleBaseSize = new SystemDrawingSize( );
  thisClientSize = new SystemDrawingSize( );
  thisControlsAdd(thisbutton);
  thisControlsAdd(thisbutton);
  thisControlsAdd(thisaxWebBrowser);
  thisName = Form;
  thisText = Form;
  ((SystemComponentModelISupportInitialize)(thisaxWebBrowser))EndInit();
  thisResumeLayout(false);
  
  
  }
  #endregion
  
  
  /// <summary>
  /// 應用程序的主入口點
  /// </summary>
  [STAThread]
  static void Main()
  {
  ApplicationRun(new Form());
  }
  
  
  private void button_Click(object sender SystemEventArgs e)
  {
  object x = SystemReflectionMissingValue;
  axWebBrowserNavigate(@E:\Documents and Settings\Administrator\桌面\ ref x ref x ref x ref x);
  }
  
  
  private void button_Click(object sender SystemEventArgs e)
  {
  mshtmlIHTMLDocument doc = (mshtmlIHTMLDocument)axWebBrowserDocument;
  mshtmlIHTMLFormElement f =(mshtmlIHTMLFormElement)em (form);
  ((mshtmlIHTMLFormElement)(f))submit();
  mshtmlIHTMLElement Element = (mshtmlIHTMLElement)em(button );
  Elementclick();
  }
  }
  }


From:http://tw.wingwit.com/Article/program/net/201311/13890.html
    推薦文章
    Copyright © 2005-2013 電腦知識網 Computer Knowledge   All rights reserved.