日期:2014-05-16  浏览次数:20498 次

版主请进 有个colorbox的问题
a.aspx页面代码

    <input type="button" value="弹窗" onclick=" aa()" />
    <script>
    function aa()
    {
            $.colorbox({href:"c.aspx"});
    }
    </script>

c.aspx页面代码
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="C.aspx.cs" Inherits="Game.Web.TG.Page.C" %>
<!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">
    <input id="Text1" type="text" />
    </form>
</body>
</html>


问题如下:
当光标在弹出的C.aspx页面的Text1文本框内时 按回车键 
弹窗就消失了 并直接进入了C.aspx   并且c.aspx页面 post了(按F5刷新 有重试确认提示)

如果删掉   <form id="form1" runat="server"></form> 就没有上述问题
但是页面还有其他服务器控件  form1绝对不能删除
form1加了onkeydown="if(event.keyCode==13)   return   false;" 也不管用

这个问题是怎么引起 怎么解决这个问题啊 
colorbox?jq

------解决方案--------------------
回车时导致表单提交了,表单增加onsubmit方法阻止表单提交就行了

    <form id="form1" runat="server" onsubmit="return false;">