通过httpwebrequest调用Javascript函数

通过httpwebrequest调用Javascript函数

问题描述:

你好朋友,

我正在使用httpwebrequest从站点获取数据.在该页面中,输入图像的类型触发了一次单击事件.此标记如下所示:

Hello Friends,

I m working to get data from site using httpwebrequest. In that page, one click event fire on image type of input.this tag is look like below:

<input type="image" name="imgbtnSubmit" id="imgbtnSubmit" tabindex="15" src="../images/searchnowblue.gif"  önclick="javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("imgbtnSubmit", "", false, "", "PropertySearch.aspx", false, false))" style="border-width:0px;" >


表单标签就像:


and form tag is like:

<form name="PropertySearchForm" method="post" action="PropertySearch.aspx"  önkeypress="javascript:return WebForm_FireDefaultButton(event, 'imgbtnSubmit')" id="PropertySearchForm">


我的问题是,如何通过http Web请求的get和post方法调用此javascript函数WebForm_DoPostBackWithOptions()?

请尽快给我解决方案.
谢谢.
Sonal Patel


my problem is that how can i call this javascript function WebForm_DoPostBackWithOptions() through http web request get and post method?

please give me solution for this ASAP.
Thank you.
Sonal Patel

您不能没有JavaScript主机,例如Web浏览器.

您正在谈论的脚本只不过是文本,直到由可以解释/编译JavaScript代码的系统对其进行处理.

一种解决方法是使用Web浏览器控件,找出按钮上的XY坐标,并向您祈祷按钮不会移动.

如果您拥有网站的来源,则还可以启用部分回调(WebMethod).这将允许您直接POST/GET到函数.

您总是可以尝试使用所需的任何参数来调用该方法(您必须为此检查HTML源代码).

最后,与网站创建者联系.请他们公开一个API(或让您访问现有的API).

干杯.
You can''t without a JavaScript host, like a web browser.

The script you''re talking about is nothing more than text until it is processed by a system that can interpret/compile JavaScript code.

One hack-of-a-way to do it would be to use a web browser control, figure out the XY co-ords on the button and pray to your deity that the button doesn''t move.

If you have the source of the web site, you can also enable partial callbacks (WebMethod). This would allow you to POST/GET to the function directly.

You could always attempt to invoke the method with whatever params are required (you''d have to check the HTML source for this).

Finally, contact the site creator. Ask them to expose an API (or give you access to an existing one).

Cheers.


感谢您的回复.

按钮位置现在固定.但是如何在特定的x,y坐标上触发onclick事件?

而且我没有其他与隐藏字段和viewstate值有关的信息.

请尽快给我解决方案.

谢谢.
Thanks for your reply.

Button position is fixed right now.But how can i fire onclick event on particular x,y co-ordinates?

and i have not another information related to hidden fields and viewstate values.

Please give me solution ASAP.

Thank you.