不使用jQuery触发Asp按钮 [英] Does not fire the Asp Button using Jquery
本文介绍了不使用jQuery触发Asp按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,我尝试使用jquery触发asp按钮,但是它不起作用.我的代码是:
Hi Guys, i was tried to fire the asp button using jquery but it does not working. My code is:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="DivMoving.aspx.cs" Inherits="DivMoving" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
<script src="js/jquery-1.8.0.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(function() {
$("#btnLeft").click(function()
{
$("#divblock").animate(
{"left":"-=50px"},"slow");
});
$("#btnRight").click(function()
{
$("#divblock").animate({"left":"+=50px"},"slow");
});
});
</script>
<style type="text/css">
div
{
position:absolute ;
background-color:Maroon ;
left:100px;
width:120px;
height:80px;
}
</style>
</head>
<body>
<form id="frm" runat="server" >
<asp:Button ID ="btnLeft" runat="server" Text="<<"/>
<asp:Button ID="btnRight" runat="server" Text=">>"/>
<div id="divblock"></div>
<%--<button id="btnLeft" runat="server" >«</button>
<button id="btnRight" runat="server" >»</button>
<div id="divblock" ></div>--%>
</form>
</body>
</html>
这里仅触发HTML控件.但不是服务器端控件.
请帮助我...
Here only fires HTML controls. but not server side controls.
Please help me...
推荐答案
(函数(){
(" ).click(功能() {
("#btnLeft").click(function() {
(" ).animate( {" :" -= 50px"}, 慢") ; });
("#divblock").animate( {"left":"-=50px"},"slow"); });
这篇关于不使用jQuery触发Asp按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文