function myalert()
{
alert("dddd")
}
在aspx文件里是这样调用的:
<script src="MyJs.js" language="javascript" type="text/javascript"></script>
后面有:
<input id="Button1" type="button" value="button" onclick="myalert()"/>
<html xmlns="http://www.w3.org/1999/xhtml"><head runat="server">
<title></title>
<script type="text/javascript">
function aa() {
var txt = document.getElementById("<%=TextBox1.ClientID %>").value
if (txt == "sf") {
document.getElementById("Label2").innerText = "aa"
}
else {
document.getElementById("Label2").innerText = "bb"
}
}
</script>
</head>
<body>
<form runat="server">
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
<asp:TextBox ID="TextBox1" runat="server" onchange="aa()" ></asp:TextBox>
<asp:Label ID="Label2" runat="server" ></asp:Label>
<asp:Label ID="Label3" runat="server" ></asp:Label>
</form>
</body>
</html>
在script中的if就是判断条件
<link type="text/css" href="此处填写你的.css文件路径" rel="stylesheet"><script src="此处填写你的js文件的路径" type="text/javascript">
以上这两个放在<head></head>标签中,就OK拉……