//结合后台设置默认回车
function SubmitKeyClick(button)
{
    try
    {
        if (event.keyCode == 13)
        {
            event.keyCode = 9;
            event.returnValue = false;

            if (button != null)
            {
                document.all(button).click();
            }
        }
    }
    catch (e){}
}

//Ctrl+Enter提交

function CtrlEnter()
{
    try
    {
        if (event.keyCode == 13 && event.ctrlKey)
        {
            alert('i can catch it!');
        }
    }
    catch (e){}
}

//收藏该源码
function cfav(cid)
{
    var cfav = document.getElementById("cfav");

    if (cfav.innerHTML == "已收藏")
    {
        return ;
    }
    else if (cfav.innerHTML == "尚未登陆")
    {
        alert("您尚未登陆，不能使用收藏夹功能！");
        return ;
    }
    cfav.innerHTML = "已收藏";
    cfav.style.textDecoration = "none";
    cfav.style.color = "red";

    //利用提交请求刷新页面(无刷新的)
    if (window.ActiveXObject)
    {
        xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
    }
    else if (window.XMLHttpRequest)
    {
        xmlHttp = new XMLHttpRequest();
    }
    posturl = "/UserAjax.aspx?act=cfav&cid=" + cid;
    xmlHttp.open("post", posturl, false);
    xmlHttp.send();

    alert("该代码收藏成功！");
}
