C#.netÖÐÓÃWinForm½ÓÊÕhtmlÒ³ÃæÏûÏ¢µÄ³ÌÐò
Ê×ÏÈдһ¸öÒ³Ãæ£¬ÉÏÃæÒª·ÅÒ»¸öButton
<html>
<head>
<title></title>
</head>
<body>
<input id="Button1" type="button" value="button" />
</body>
</html>
½«Æä±£´æÔÚHomePage.htmÖУ¬
Ö®ºóÎÒÃǽ¨Ò»¸öWinForm£¬
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace SXT.Frame.Ctrler.Test
{
public partial class HtmlUi : Form
{
public HtmlUi()
{
InitializeComponent();
this.webBrowser1.Navigate("D:\\SXT\\bin\\Debug\\HomePage.htm");//±¾µØÎļþ·¾¶
}
private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
HtmlDocument htmlDoc = this.webBrowser1.Document;
HtmlElement btnElement = htmlDoc.All["Button1"];
if (btnElement != null)
{
btnElement.Click += new HtmlElementEventHandler(btnElement_Click);
}
}
void btnElement_Click(object sender, HtmlElementEventArgs e)
&n
Ïà¹ØÎĵµ£º
http://blog.stchur.com/2010/01/15/programmatically-clicking-a-link-in-javascript/
×÷Õß½éÉÜÈçºÎÓÃjavascriptÄ£ÄâÓû§ÕæÊµµÄµã»÷¡£
Õâ¿´ÉÏÈ¥ºÃÏñºÜ¼òµ¥£¬¶ÁÈ¡hrefÈ»ºóÀûÓÃwindow.location.href²»¾ÍÐÐÁËÂð£¿
Æäʵ²»È»£¬ÔÒòÔÚÓÚÏÖÔÚµÄÍøÒ³ÀïµÄÁ´½Ó²»µ¥ÊÇÖ±½Ó¶ÁÈ¡hrefÊôÐÔÈ»ºóÌø×ªµ½ÁíÒ»¸öÒ³Ãæ£¬ÓÐЩÁ´½Ó¿ÉÒÔ¼ÓÉÏevent ......
//»ñÈ¡°üº¬Çåµ¥µÄÒѼÓÔØÎļþµÄ·¾¶»ò UNC λÖá£
public static string sApplicationPath = Assembly.GetExecutingAssembly ( ).Location;
//result: X:\xxx\xxx\xxx.dll (.dllÎļþËùÔÚµÄĿ¼+.dllÎļþÃû)
//»ñÈ¡µ±Ç°½ø³ÌµÄÍêÕû·¾¶£¬°üº¬ÎļþÃû(½ø³ÌÃû)¡£
string str = this.GetType ( ).Assembly.Location;
//result ......
ÀÏʦÁô×÷Òµ×ö¸ö¼òµ¥Í¼Ïñä¯ÀÀ¼Ó¸÷Öַת+͸Ã÷+ºÚ°×Á¬Ðø´¦ÀíµÄhtml,±¾ÒÔΪºÜÈÝÒ×,
ËÖªµÀһ۲ŷ¢ÏÖ»ðºü¸ß°æ±¾µÄinput file ºÍIeÖеIJ»Ò»Ñù
JSÖÐfileObj.value Ö»Äܵõ½ÎļþÃû...
¸ãµÃÄÔ´üÖ±´ó
»ðºü3ÒÔÉϰ汾ÓÐbug ÒòΪinput file ²»Ö§³Ö»ñÈ¡ÎļþÍêÕû·¾¶,±È½ÏÍ´¿à,½â¾ö²»ÁË,ËùÒÔ²»ÄÜ·¢urlµ½servletÖÐ,ÒÔÖÁÓÚÖ»ÄÜä¯ÀÀ
² ......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;
namespace ConsoleApplication4
{
class Program
{
static void Main(string[] args)
{
//sqlserverÉí·ÝÑéÖ¤
//string sqlconn = "ser ......