js调用C#的办法
前台html页面上有个按钮,点击后触发js方法,js方法调用C#,请问要怎么实现
代码如下:
c#代码
代码如下:
<html>
<head>
<title></title>
<script type="text/javascript">
function bclick() {
document.write("<%=CsharpVoid();%>");
}
</script>
</head>
<body>
<input id="Button1" type="button" value="click" onclick="bclick();" />
</body>
</html>
c#代码
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Threading;
using System.Web;
namespace go
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
MessageBox.Show("hello");
}
protected string CsharpVoid()
{
string strCC = "hello";
return strCC;
}
}
}
...全文
相关推荐
js+ajax实现获取文件大小的方法
主要介绍了js+ajax实现获取文件大小的方法,涉及JavaScript调用ajax交互及后台C#文件操作的相关技巧,需要的朋友可以参考下
能说明你的Javascript技术很烂的五个原因
Javascript在互联网上名声很臭,但你又很难再找到一个像它这样如此动态、如此被广泛使用、如此根植于我们的生活中的另外一种语言。它的低学习门槛让很多人都称它为学前脚本语言,它另外一个让人嘲笑的东西是动态语言的概念是偏偏使用了高标准的静态数据类型。其实,你和Javascript都站错了立场,而现在,你让Javascript很生气。这里有五个原因能说明你的Javascript技术很烂。
Unity 3d C#和Javascript脚本互相调用 解决方案
Unity 3d C#和Javascript脚本互相调用 解决方案.
JS调用C#后台方法
js调用后台方法 js JS调用后台 JS后台方法 用到了[WebService]特性
JS调用c#编写的DLL 源代码
JS调用c#编写的DLL 源代码 包含c#新建类库,生成DLL,以及DLL的注册 ,JS调用DLL的两种方法的整个过程。


