复制代码 代码如下:
public string Hello()
{
return("Hello World");
}
复制代码 代码如下:
<html xmlns="http://www.w3.org/1999/xhtml%22>
<head runat="server">
<title>Untitled Page</title>
<script language="javascript" type="text/javascript">
function say()
{
var strHello = "<%=Hello()%>";
alert(strHello);
}
</script>
</head>
<body>
<form runat="server">
<div>
<asp:Button runat="server" Text="Button" OnClientClick="say();" />
</div>
</form>
</body>
</html>
复制代码 代码如下:
<script language="javascript">
function __doPostBack(eventTarget, eventArgument)
{
var frontForm = document.Form1; //指runat=server的form
frontForm.__EVENTTARGET.value = eventTarget;
frontForm.__EVENTARGUMENT.value = eventArgument;
frontForm.submit();
}
</script>
<input type="button" value="按钮">
复制代码 代码如下:
private void Button2_Click(object sender, System.EventArgs e)
{
string str;
str="<script language='javascript'>";
str+="selectRange()";
str+="</script>";
//Literal1.Visible=true;
Literal1.Text=str;
}
新闻热点
疑难解答
图片精选