<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %><!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>
<link href="Res/Css/Storage.css" rel="stylesheet" type="text/css" />
<script src="Res/JS/jquery-1.6.js" language="javascript" type="text/javascript"></script>
<script src="Res/JS/popup_layer.js" language="javascript" type="text/javascript"></script>
<script src="Res/JS/Storage.js" language="javascript" type="text/javascript"></script>
</head><body>
<form id="form1" runat="server">
<div>
<div id="Commoditylist" class="CommoditylistC" >
<h2>商品列表</h2>
<ul>
<li><asp:CheckBox ID="CheckBox1" runat="server" Text="商品信息" /></li>
<li><asp:CheckBox ID="CheckBox2" runat="server" Text="商品信息" /></li>
<li><asp:CheckBox ID="CheckBox3" runat="server" Text="商品信息" /></li>
<li><asp:CheckBox ID="CheckBox4" runat="server" Text="商品信息" /></li>
</ul>
<asp:Button ID="Ok" runat="server" Text="确定" style="float:right" OnClick="Ok_Click"/> //无效的Button
</div>
<input id="btnselect" type="button" value="选择商品" />
</div>
</form>
</body>
</html>using System;
using System.Data;
using System.Configuration;
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;public partial class _Default : System.Web.UI.Page
{
#region 页面Page_Load事件处理
/// <summary>
/// 页面Page_Load事件处理
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
}
}
#endregion #region 选择商品确定
/// <summary>
/// 选择商品确定
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Ok_Click(object sender, EventArgs e)
{
Response.Write("<script>alert('我可以用')</script>");
}
#endregion
}
<head runat="server">
<title>测试</title>
<link href="Res/Css/Storage.css" rel="stylesheet" type="text/css" />
<script src="Res/JS/jquery-1.6.js" language="javascript" type="text/javascript"></script>
<script src="Res/JS/popup_layer.js" language="javascript" type="text/javascript"></script>
<script src="Res/JS/Storage.js" language="javascript" type="text/javascript"></script>
</head><body>
<form id="form1" runat="server">
<div>
<div id="Commoditylist" class="CommoditylistC" >
<h2>商品列表</h2>
<ul>
<li><asp:CheckBox ID="CheckBox1" runat="server" Text="商品信息" /></li>
<li><asp:CheckBox ID="CheckBox2" runat="server" Text="商品信息" /></li>
<li><asp:CheckBox ID="CheckBox3" runat="server" Text="商品信息" /></li>
<li><asp:CheckBox ID="CheckBox4" runat="server" Text="商品信息" /></li>
</ul>
<asp:Button ID="Ok" runat="server" Text="确定" style="float:right" OnClick="Ok_Click"/> //无效的Button
</div>
<input id="btnselect" type="button" value="选择商品" />
</div>
</form>
</body>
</html>using System;
using System.Data;
using System.Configuration;
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;public partial class _Default : System.Web.UI.Page
{
#region 页面Page_Load事件处理
/// <summary>
/// 页面Page_Load事件处理
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
}
}
#endregion #region 选择商品确定
/// <summary>
/// 选择商品确定
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Ok_Click(object sender, EventArgs e)
{
Response.Write("<script>alert('我可以用')</script>");
}
#endregion
}
解决方案 »
- MVC3.0
- 关于csdn回复框下面的 举报、丢个板砖等功能是怎么做的?
- mastpage是什么意思?
- 能不能在OUTLOOK里面实现数据库操作?
- Asp.net如何设计用户时间段(年月日时分秒)输入
- 在线等。关于2.0验证控件为何在本机上测试可以,传到服务器上就不行了!需要改什么配置?
- 动态加载主题的问题,asp.2.0开发指南的书有错还是??同志请进
- 【请教高手】如何找到DataGrid模板列中的DropDownList?该DropDownList放置在EditItemTemplate里面
- .NET中access导入SQL中的奇怪问题
- 又是DataGrid的问题,请各位帮忙,谢谢!!
- asp.net可以模拟鼠标键盘吗?象桌面程序一样
- asp.net的窗体 如何根据显示器大小而改变窗体内控件的位置 使控件相对位置不变?
<asp:Button ID="Ok" runat="server" Text="确定" style="float:right" onclick="Ok_Click"/>
你说的调试没有进代码的问题解决办法。。在该页的cs代码多打几处断点,是指起始页,从其他页面跳转过来反正多试试。vs有时候比较蛋疼。。
<script src="Res/JS/jquery-1.6.js" language="javascript" type="text/javascript"></script>
<script src="Res/JS/popup_layer.js" language="javascript" type="text/javascript"></script>
<script src="Res/JS/Storage.js" language="javascript" type="text/javascript"></script>这三个JS是用来控制这个DIV我要是把他们删掉就可以了
第一个大家都知道是jquery的库
第二个是一个弹出层的东西(我在网上找的)
第三个是调用第二个里面的方法执行弹出(参考http://www.51xuediannao.com/jQuery/jQuery_tanchu/)
<script src="Res/JS/jquery-1.6.js" language="javascript" type="text/javascript"></script>
<script src="Res/JS/popup_layer.js" language="javascript" type="text/javascript"></script>
<script src="Res/JS/Storage.js" language="javascript" type="text/javascript"></script>这三个JS是用来控制这个DIV我要是把他们删掉就可以了
第一个大家都知道是jquery的库
第二个是一个弹出层的东西(我在网上找的)
第三个是调用第二个里面的方法执行弹出(参考http://www.51xuediannao.com/jQuery/jQuery_tanchu/)
应该是其他方面影响到的
很可能你的js 文件中添加了对这个按钮的客户端事件
仔细查下你的js 文件中的类容
Function.prototype.binding = function() {
if (arguments.length < 2 && typeof arguments[0] == "undefined") return this;
var __method = this, args = jQuery.makeArray(arguments), object = args.shift();
return function() {
return __method.apply(object, args.concat(jQuery.makeArray(arguments)));
}
}var Class = function(subclass){
subclass.setOptions = function(options){
this.options = jQuery.extend({}, this.options,options);
for(var key in options){
if(/^on[A-Z][A-Za-z]*$/.test(key)){
$(this).bind(key,options[key]);
}
}
}
var fn = function(){
if(subclass._init && typeof subclass._init == 'function'){
this._init.apply(this,arguments);
}
}
if(typeof subclass == 'object'){
fn.prototype = subclass;
}
return fn;
}var PopupLayer = new Class({
options:{
trigger:null, //触发的元素或id,必填参数
popupBlk:null, //弹出内容层元素或id,必填参数
closeBtn:null, //关闭弹出层的元素或id
popupLayerClass:"popupLayer", //弹出层容器的class名称
eventType:"click", //触发事件的类型
offsets:{ //弹出层容器位置的调整值
x:0,
y:0
},
useFx:false, //是否使用特效
useOverlay:false, //是否使用全局遮罩
usePopupIframe:true, //是否使用容器遮罩
isresize:true, //是否绑定window对象的resize事件
onBeforeStart:function(){} //自定义事件
},
_init:function(options){
this.setOptions(options); //载入设置
this.isSetPosition = this.isDoPopup = this.isOverlay = true; //定义一些开关
this.popupLayer = $(document.createElement("div")).addClass(this.options.popupLayerClass); //初始化最外层容器
this.popupIframe = $(document.createElement("iframe")).attr({border:0,frameborder:0}); //容器遮罩,用于屏蔽ie6下的select
this.trigger = $(this.options.trigger); //把触发元素封装成实例的一个属性,方便使用及理解
this.popupBlk = $(this.options.popupBlk); //把弹出内容层元素封装成实例的一个属性
this.closeBtn = $(this.options.closeBtn); //把关闭按钮素封装成实例的一个属性
$(this).trigger("onBeforeStart"); //执行自定义事件。
this._construct() //通过弹出内容层,构造弹出层,即为其添加外层容器及底层iframe
this.trigger.bind(this.options.eventType,function(){ //给触发元素绑定触发事件
if(this.isSetPosition){
this.setPosition(this.trigger.offset().left + this.options.offsets.x, this.trigger.offset().top + this.trigger.get(0).offsetHeight + this.options.offsets.y);
}
this.options.useOverlay?this._loadOverlay():null; //如果使用遮罩则加载遮罩元素
(this.isOverlay && this.options.useOverlay)?this.overlay.show():null;
if(this.isDoPopup && (this.popupLayer.css("display")== "none")){
this.options.useFx?this.doEffects("open"):this.popupLayer.show();
}
}.binding(this));
this.isresize?$(window).bind("resize",this.doresize.binding(this)):null;
this.options.closeBtn?this.closeBtn.bind("click",this.close.binding(this)):null; //如果有关闭按钮,则给关闭按钮绑定关闭事件
},
_construct:function(){ //构造弹出层
this.popupBlk.show();
this.popupLayer.append(this.popupBlk.css({opacity:1})).appendTo($(document.body)).css({position:"absolute",'z-index':2,width:this.popupBlk.get(0).offsetWidth,height:this.popupBlk.get(0).offsetHeight});
this.options.usePopupIframe?this.popupLayer.append(this.popupIframe):null;
this.recalculatePopupIframe();
this.popupLayer.hide();
},
_loadOverlay:function(){ //加载遮罩
pageWidth = ($.browser.version=="6.0")?$(document).width()-21:$(document).width();
this.overlay?this.overlay.remove():null;
this.overlay = $(document.createElement("div"));
this.overlay.css({position:"absolute","z-index":1,left:0,top:0,zoom:1,display:"none",width:pageWidth,height:$(document).height()}).appendTo($(document.body)).append("<div style='position:absolute;z-index:2;width:100%;height:100%;left:0;top:0;opacity:0.3;filter:Alpha(opacity=30);background:#000'></div><iframe frameborder='0' border='0' style='width:100%;height:100%;position:absolute;z-index:1;left:0;top:0;filter:Alpha(opacity=0);'></iframe>")
},
doresize:function(){
this.overlay?this.overlay.css({width:($.browser.version=="6.0")?$(document).width()-21:$(document).width(),height:($.browser.version=="6.0")?$(document).height()-4:$(document).height()}):null;
if(this.isSetPosition){
this.setPosition(this.trigger.offset().left + this.options.offsets.x, this.trigger.offset().top + this.trigger.get(0).offsetHeight + this.options.offsets.y);
}
},
setPosition:function(left,top){ //通过传入的参数值改变弹出层的位置
this.popupLayer.css({left:left,top:top});
},
doEffects:function(way){ //做特效
way == "open"?this.popupLayer.show("slow"):this.popupLayer.hide("slow");
},
recalculatePopupIframe:function(){ //重绘popupIframe,这个不知怎么改进,只好先用这个笨办法。
this.popupIframe.css({position:"absolute",'z-index':-1,left:0,top:0,opacity:0,width:this.popupBlk.get(0).offsetWidth,height:this.popupBlk.get(0).offsetHeight});
},
close:function(){ //关闭方法
this.options.useOverlay?this.overlay.hide():null;
this.options.useFx?this.doEffects("close"):this.popupLayer.hide();
}
});
Function.prototype.binding = function() {
if (arguments.length < 2 && typeof arguments[0] == "undefined") return this;
var __method = this, args = jQuery.makeArray(arguments), object = args.shift();
return function() {
return __method.apply(object, args.concat(jQuery.makeArray(arguments)));
}
}var Class = function(subclass){
subclass.setOptions = function(options){
this.options = jQuery.extend({}, this.options,options);
for(var key in options){
if(/^on[A-Z][A-Za-z]*$/.test(key)){
$(this).bind(key,options[key]);
}
}
}
var fn = function(){
if(subclass._init && typeof subclass._init == 'function'){
this._init.apply(this,arguments);
}
}
if(typeof subclass == 'object'){
fn.prototype = subclass;
}
return fn;
}var PopupLayer = new Class({
options:{
trigger:null, //触发的元素或id,必填参数
popupBlk:null, //弹出内容层元素或id,必填参数
closeBtn:null, //关闭弹出层的元素或id
popupLayerClass:"popupLayer", //弹出层容器的class名称
eventType:"click", //触发事件的类型
offsets:{ //弹出层容器位置的调整值
x:0,
y:0
},
useFx:false, //是否使用特效
useOverlay:false, //是否使用全局遮罩
usePopupIframe:true, //是否使用容器遮罩
isresize:true, //是否绑定window对象的resize事件
onBeforeStart:function(){} //自定义事件
},
_init:function(options){
this.setOptions(options); //载入设置
this.isSetPosition = this.isDoPopup = this.isOverlay = true; //定义一些开关
this.popupLayer = $(document.createElement("div")).addClass(this.options.popupLayerClass); //初始化最外层容器
this.popupIframe = $(document.createElement("iframe")).attr({border:0,frameborder:0}); //容器遮罩,用于屏蔽ie6下的select
this.trigger = $(this.options.trigger); //把触发元素封装成实例的一个属性,方便使用及理解
this.popupBlk = $(this.options.popupBlk); //把弹出内容层元素封装成实例的一个属性
this.closeBtn = $(this.options.closeBtn); //把关闭按钮素封装成实例的一个属性
$(this).trigger("onBeforeStart"); //执行自定义事件。
this._construct() //通过弹出内容层,构造弹出层,即为其添加外层容器及底层iframe
this.trigger.bind(this.options.eventType,function(){ //给触发元素绑定触发事件
if(this.isSetPosition){
this.setPosition(this.trigger.offset().left + this.options.offsets.x, this.trigger.offset().top + this.trigger.get(0).offsetHeight + this.options.offsets.y);
}
this.options.useOverlay?this._loadOverlay():null; //如果使用遮罩则加载遮罩元素
(this.isOverlay && this.options.useOverlay)?this.overlay.show():null;
if(this.isDoPopup && (this.popupLayer.css("display")== "none")){
this.options.useFx?this.doEffects("open"):this.popupLayer.show();
}
}.binding(this));
this.isresize?$(window).bind("resize",this.doresize.binding(this)):null;
this.options.closeBtn?this.closeBtn.bind("click",this.close.binding(this)):null; //如果有关闭按钮,则给关闭按钮绑定关闭事件
},
_construct:function(){ //构造弹出层
this.popupBlk.show();
this.popupLayer.append(this.popupBlk.css({opacity:1})).appendTo($(document.body)).css({position:"absolute",'z-index':2,width:this.popupBlk.get(0).offsetWidth,height:this.popupBlk.get(0).offsetHeight});
this.options.usePopupIframe?this.popupLayer.append(this.popupIframe):null;
this.recalculatePopupIframe();
this.popupLayer.hide();
},
_loadOverlay:function(){ //加载遮罩
pageWidth = ($.browser.version=="6.0")?$(document).width()-21:$(document).width();
this.overlay?this.overlay.remove():null;
this.overlay = $(document.createElement("div"));
this.overlay.css({position:"absolute","z-index":1,left:0,top:0,zoom:1,display:"none",width:pageWidth,height:$(document).height()}).appendTo($(document.body)).append("<div style='position:absolute;z-index:2;width:100%;height:100%;left:0;top:0;opacity:0.3;filter:Alpha(opacity=30);background:#000'></div><iframe frameborder='0' border='0' style='width:100%;height:100%;position:absolute;z-index:1;left:0;top:0;filter:Alpha(opacity=0);'></iframe>")
},
doresize:function(){
this.overlay?this.overlay.css({width:($.browser.version=="6.0")?$(document).width()-21:$(document).width(),height:($.browser.version=="6.0")?$(document).height()-4:$(document).height()}):null;
if(this.isSetPosition){
this.setPosition(this.trigger.offset().left + this.options.offsets.x, this.trigger.offset().top + this.trigger.get(0).offsetHeight + this.options.offsets.y);
}
},
setPosition:function(left,top){ //通过传入的参数值改变弹出层的位置
this.popupLayer.css({left:left,top:top});
},
doEffects:function(way){ //做特效
way == "open"?this.popupLayer.show("slow"):this.popupLayer.hide("slow");
},
recalculatePopupIframe:function(){ //重绘popupIframe,这个不知怎么改进,只好先用这个笨办法。
this.popupIframe.css({position:"absolute",'z-index':-1,left:0,top:0,opacity:0,width:this.popupBlk.get(0).offsetWidth,height:this.popupBlk.get(0).offsetHeight});
},
close:function(){ //关闭方法
this.options.useOverlay?this.overlay.hide():null;
this.options.useFx?this.doEffects("close"):this.popupLayer.hide();
}
});
按你描述,应该是js冲突的问题。
OnClick -> onClick 大小写··
Ok_Click后面少括号。