有A和B两个页面
页面A 用ajax成功调用到页面B
此时页面A 的上方是页面B的内容(页面B 在页面A 的一个DIV里面)
页面B有一个按钮 当我点击这个按钮时
程序没有执行该按钮的事件
而是自动跳到了页面B
我怎么才能既不跳到页面B 又能执行页面B按钮的事件呢
请大家帮帮忙 举个例子 在线等
页面A 用ajax成功调用到页面B
此时页面A 的上方是页面B的内容(页面B 在页面A 的一个DIV里面)
页面B有一个按钮 当我点击这个按钮时
程序没有执行该按钮的事件
而是自动跳到了页面B
我怎么才能既不跳到页面B 又能执行页面B按钮的事件呢
请大家帮帮忙 举个例子 在线等
$.ajax({
url: "B.aspx",
data: {command:"addzxhot",value:id},
type: "post"
success:function(data)
{
$("#div").val(data);
}
});
}
你用的是服务器控件么?应该不会出现点击html按钮跳转到B.aspx页面的情况,我也没测试过.....
我想把一个页面添加多个 Slickupload 控件 用于实现多文件 “多进度条上传”(主要是在一个页面中 多几个上传的功能接口 )
但是结果报错了 大概的错误原因是 “一个页面不允许有多个UploadProgressDisplay”
于是我就想到异步调用 做创建几个页面 每个页面都放一个Slickupload 这样的话A页面调用B页面 而B页面又调用C页面 达到的效果就是 在一个页面中 有好多Slickupload 控件 这样 就能避免上面的错误了 不知道用异步调用能不能实现啊 不要笑我啊 我不太会ajax啊
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Demo2.aspx.cs" Inherits="WebApplication1.Demo2" %><%@ Register Src="UpLoadUserControl.ascx" TagName="UpLoadUserControl" TagPrefix="uc1" %><!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>
<title>无标题页</title>
<script type="text/javascript">
var XmlHttp=new ActiveXObject("Microsoft.XMLhttp");
function sendRequest()
{
XmlHttp.Open("POST","Demo.aspx",true);//请求数据页面
XmlHttp.send(null);
XmlHttp.onreadystatechange=ServerState;//设置监听状态
}
//请求到数据时显示到页面
function ServerState()
{
if (XmlHttp.readystate==4 || XmlHttp.readystate=='complete')
{
document.getElementById('contentList').innerHTML =XmlHttp.responsetext;
}
}
setInterval('sendRequest()',5000);//设置更新时间
</script>
</head>
<body>
<div id="contentList"></div>
<hr />
<div id="Div1">222</div>
<hr />
<div id="Div2">333</div>
</body>
</html>
去掉 就能运行
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Demo.aspx.cs" Inherits="WebApplication1.Demo" %><!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>无标题页</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="郁闷了" /></div>
</form>
</body>
</html>
cs:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;namespace WebApplication1
{
public partial class Demo : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{ } protected void Button1_Click(object sender, EventArgs e)
{
Response.Write("<script>alert('跳页了 郁闷 !!! 我不想跳啊 ')</script>");
}
}
}