是否有任何方法可以通过C#在Web上执行javascript [英] is there any way to execute javascript on web by C#

查看:68
本文介绍了是否有任何方法可以通过C#在Web上执行javascript的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好。

在这个网站上( http: //bizonline.ir/samsung/83--samsung-i9190-galaxy-s4-mini.html [ ^ ])当我更改下拉菜单并选择其中一个项目时,价格(id =our_price_display)将会改变。已访问该网页并捕获整个网页,现在当我在下拉代码中更改所选项目时,它不会影响该id.how我可以更改吗?我认为这是一个javascript函数。你能帮助我那样做吗?

这是一个波斯网站,对不起我找不到英文样本

hi all
on this website(http://bizonline.ir/samsung/83--samsung-i9190-galaxy-s4-mini.html[^]) when i change drop down and choose one of the items the price(id="our_price_display") will change.i have accessed to that webpage and captured the whole webpage and now when i change selected item in drop down by code ,it does not affect on that id.how can i change it?i think it is a javascript function.can you help me to do that?
it a Persian website ,sorry i could not find English sample

推荐答案

虽然你的问题不是很明确但是我的问题通过您提供的网页了解 -



更改项目将改变飞行价格。

你正在做自动回发因为它,因此wh发生了页面刷新,你的页面因为某些原因而完全被吮吸而无所事事。



理想的处理方法是使用Javascript或Jquery使用Ajax。 />
Javascript是一种脚本语言,可以与您用于开发Web应用程序的任何语言一起使用。

调用与javascript相同,不是基于C#,它在客户端完全处理使用客户端的资源。



C#,PHP,JSP任何其他网络语言,你都可以使用javascript。



这里使用ajax的基本原理 -

1.执行客户端下拉列表更改事件

2.使用Ajax调用服务器端方法。

3.将您选择的产品项目的ID通过ajax下载到服务器端

4.收取sp或内联查询以获取显示所需的价格和其他详细信息
5.使用JSON格式的数据或您的自定义数据格式来获取所有值并将其传递给客户端si de

6.一旦你在客户端获得数据,使用javascript显示在所需的控件中。



现在如果你问我对于代码,我建议你谷歌,你会得到大量这样的代码。



祝你好运!

干杯
Sandip
Though your question is not very clear but what I understood going through the web page you have provided -

Changing the item will change the price on fly.
And you are doing auto postback for it and thus a whole page refresh occurred and your page gets suck completely and doing nothing for some reason.

The ideal way to handle this is to use Ajax using Javascript or Jquery.
Javascript is a scripting language that can be used with any language you use to develop web app.
The calling is same as javascript is not C# based and it's completely processed in client's end using client's resource.

C#, PHP, JSP any other web language, you can use javascript.

The fundamentals of using ajax here -
1. execute client side dropdown change event
2. Use Ajax to call the server side method.
3. Pass the id of the product item you select in drop down to server side through ajax
4. Charge a sp or inline query to get the price and other details you need to show
5. use a JSON format of data or your custom data format to get all the values and pass it to client side
6. Once you get the data in client side, use javascript to display in the desired controls.

Now if you ask me for the code, I will suggest you to google and you will get tons of such code.

Good luck!
Cheers
Sandip


这篇关于是否有任何方法可以通过C#在Web上执行javascript的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆