最近~

最近终于可算是把SSIS的东西稍微大概的过了一次,然后给部门的人做了个报告,让大家了解了SSIS的强大之处。因为之前一直用的是2000的数据局,所以说关于定时传送数据这些玩意用的是2000的DTS,现在嘛就是可能要把数据库从sql server 2000升级到sql server 2008,所以这些东西也必须迁移过去。当然,在2008中已经提供了2000的DTS导入到2008的功能,但是事情并不是那么如愿的,出现了各种意想不到的错误,总之,要完全导过来,正确运行,会有不少麻烦。所以就有了对SSIS的学习,估计当真正要进行转移的时候就直接进行SSIS开发的迁移了,而不是是简答的使用一个导入功能了。以后在项目中用到时再详细考虑和学习。

从昨天开始重新拾起对jQuery的学习了,慢慢的看一些code,学会去改造,也算是熟悉一些常见的用法吧~

昨天在博客园http://www.cnblogs.com/mqingqing123/archive/2009/10/16/1584727.html介绍了一些jQuery中Ajax的用法,最后一个是类似于博客园闪一下的实现方式,我把代码包下载下来研究了研究,发现里面的JS文件完全是咱们博客园的东西嘛,哈哈,好玩,试着copy下来,玩了玩~

html页面很简单,就是一个txtbox,一个用于提交的链接,一个显示所闪内容的段落

 

代码
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="flash.aspx.cs" Inherits="WebApplication1.flash" %>

<!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 id="Head1" runat="server">
    
<title></title>

    
<script src="js/jquery.js" type="text/javascript"></script>

    
<script src="js/common.js" type="text/javascript"></script>

</head>
<body>
    
<form id="form1" runat="server">
    
<div>
        
<input id="txt_ing" onkeydown="return PublicIngEnter(event)" value="你在做什么?你在想什么?"
            onclick
="HideTip()" onblur="IngIsEmpty();" />
    
</div>
    
<class="btn_green" href="###" id= "btn_ing_publish" onclick="publish_ing();return false;">
        闪一下
</a>
    
<br />
    
<id="ing_current"></p>
    
<span id="last_ing" style="visibility:hidden"></span>

    
<script type="text/javascript">
        $(document).ready(
function() {
        
if ($("#txt_ing").val() == "你在做什么?你在想什么?") {
            $(
"#txt_ing").css("color""#BBB");
            $(
"#txt_ing").css("font-size""12px");
        };
        });

    
</script>
    
</form>
</body>
</html>

 

发现咱博客园的Js文件才是重点,知道了jQuery中函数,方法该怎么用了~

 

代码
function publish_ing() {
    
var ingContent = $("#txt_ing").val();
    
if (ingContent.length > 140) {
        alert(
'闪存内容不能超过140个字符!当前字符数: ' + ingContent.length);
        
return;
    }


    $(
"#btn_ing_publish").text("提交中..");

    
if (ingContent == "你在做什么?你在想什么?" || ingContent == "" || ingContent == "提示:请输入内容") {
        $(
"#btn_ing_publish").text("闪一下");
        $(
"#txt_ing").val('提示:请输入内容');
        window.setTimeout(
function() { if ($("#txt_ing").val() == "提示:请输入内容") { $("#txt_ing").val('你在做什么?你在想什么?'); } }, 2000);
        
return;
    }


    ingContent 
= ingContent.replace(/\x22/g, "").replace(/\\/g, "\\\\");

    
var lastcontent = $("#last_ing").html();
    
if (ingContent == lastcontent) {
        alert(
"该内容刚闪过啦");
        $(
"#btn_ing_publish").text("闪一下");
        
return;
    }
    
else
        $(
"#last_ing").html(ingContent);



    $.ajax({
        url: 
'returnMsg.aspx/getdata',
        data: 
'{param:"' + ingContent + '"}',
        type: 
'post',
        dataType: 
'json',
        contentType: 
'application/json; charset=utf-8',
        cache: 
false,
        success: 
function(data) {
            
if (data.d == "success") {
                
if (ingContent.length > 40) {
                    $(
"#ing_current").html(ingContent.substring(040));
                }
                
else {
                    $(
"#ing_current").html(ingContent);
                }
                $(
"#txt_ing").val('');
                
//AppendNewIng(ingContent.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;'));
            }
            
else {
                alert(
"相同内容已存在");
            }
            $(
"#btn_ing_publish").text("闪一下");
        },
        error: 
function(xhr) {
            alert(xhr.responseText);
            $(
"#btn_ing_publish").text("闪一下");
        }
    });
}
function PublicIngEnter(event) {
    
if (event.keyCode == 13) {
        publish_ing();
        
return false;
    }
}
function AppendNewIng(ingContent) {
    
if ($("#feed_list"!= "") {
        
var url = $("#lnk_current_user").attr("href");
        
var username = $("#lnk_current_user").attr("title");
        
var avatar = $("#img_current_avatar").attr("src");
        
var ingstr = '<li class="entry_a"><img class="pmu" src="' + avatar + '"/> <a href="' + url + '" class="big_font blue">' + username + '</a>:<span class="big_font">' + ingContent + '</span></li>';
        $(
"#feed_list").prepend(ingstr);
    }
}
function SearchUser() {
    
if ($('#txt_user_name').val() == '' || $('#txt_user_name').val() == '先输入内容') {
        $(
'#txt_user_name').val('先输入内容');
        $(
'#txt_user_name').css('color''gray');
        window.setTimeout(
function() { if ($("#txt_user_name").val() == "先输入内容") { $("#txt_user_name").val(''); $('#txt_user_name').css('color''#000'); } }, 1000);
    }
    
else {
        
var keystr = encodeURIComponent($('#txt_user_name').val());
        window.location 
= "/user/Search.aspx?key=" + keystr;
    }
}
function SearchUserEnter(event) {
    
if (event.keyCode == 13) {
        SearchUser();
        
return false;
    }
}
function zzk_go() {
    
var keystr = encodeURIComponent(document.getElementById('q').value);
    window.location 
= "http://zzk.cnblogs.com/s?w=" + keystr;
}
function zzk_go_enter(event) {
    
if (event.keyCode == 13) {
        zzk_go();
        
return false;
    }
}
function CheckMsg() {
    
if ($("#msg_count"!= "") {
        $.ajax({
            url: 
'/WebService/UserService.asmx/GetUnreadMsgCount',
            data: 
'{}',
            type: 
'post',
            dataType: 
'json',
            contentType: 
'application/json; charset=utf-8',
            cache: 
false,
            success: 
function(data) {
                
if (data.d > 0) {
                    $(
"#msg_count").html("[" + data.d + "]");
                }
            },
            error: 
function(xhr) {
                
if (xhr.responseText != '') {
                    alert(xhr.responseText);
                }
            }
        });
    }
}

function GetLastIng() {
    
if ($("#last_ing_block"!= "") {
        $.ajax({
            url: 
'/WebService/IngManage.asmx/GetLastIng',
            data: 
'{}',
            type: 
'post',
            dataType: 
'json',
            contentType: 
'application/json; charset=utf-8',
            cache: 
false,
            success: 
function(data) {
                
if (data.d) {
                    $(
"#last_ing_block").html(data.d);
                }
            },
            error: 
function(xhr) {
                alert(xhr.responseText);
            }
        });
    }
}

function GetRelativeUserCount() {
    
if ($("#span_friend_count"!= '') {
        $.ajax({
            url: 
'/WebService/UserService.asmx/GetRelativeUserCount',
            data: 
'{}',
            type: 
'post',
            dataType: 
'json',
            contentType: 
'application/json; charset=utf-8',
            cache: 
false,
            success: 
function(data) {
                
if (data.d) {
                    $(
"#span_friend_count").html("(" + data.d[0+ ")");
                    $(
"#span_following_count").html("(" + data.d[1+ ")");
                    $(
"#span_follower_count").html("(" + data.d[2+ ")");
                }
            },
            error: 
function(xhr) {
                
if (xhr.responseText != '') {
                    alert(xhr.responseText);
                }
            }
        });
    }
}

function GetRelativeUserCount2() {
    
var userId = $("#userId").html();
    
if (userId != '') {
        $.ajax({
            url: 
'/WebService/UserService.asmx/GetRelativeUserCountByUserID',
            data: 
'{userId:"' + userId + '"}',
            type: 
'post',
            dataType: 
'json',
            contentType: 
'application/json; charset=utf-8',
            cache: 
false,
            success: 
function(data) {
                
if (data.d) {
                    $(
"#span_friend_count").html("(" + data.d[0+ ")");
                    $(
"#following_count").html(data.d[1]);
                    $(
"#follower_count").html(data.d[2]);
                }
            },
            error: 
function(xhr) {
                
if (xhr.responseText != '') {
                    alert(xhr.responseText);
                }
            }
        });
    }
}

function login() {
    location.href 
= "http://passport.cnblogs.com/login.aspx?ReturnUrl=" + location.href;
    
return false;
}

function register() {
    location.href 
= "http://passport.cnblogs.com/register.aspx?ReturnUrl=" + location.href;
    
return false;
}

function logout() {
    
if (confirm('确定要退出吗?')) {
        location.href 
= "http://passport.cnblogs.com/logout.aspx?ReturnUrl=" + location.href;
    }
    
return false;
}

function GetIngComments(ingId, isIngPage) {
    GetIngRecentComments(ingId, 
15, isIngPage);
}

function GetIngRecentComments(ingId, showcount, isIngPage) {
    $.ajax({
        url: 
'/WebService/CommentManager.asmx/GetIngRecentComments',
        data: 
'{ingId:' + ingId + ',showcount:' + showcount + '}',
        type: 
'post',
        dataType: 
'json',
        contentType: 
'application/json; charset=utf-8',
        cache: 
false,
        success: 
function(data) {
            
if (data.d) {
                
var content = data.d;
                
if (isIngPage) {
                    content 
= "<div class=\"ing_comments\">" + data.d + "</div>";
                }
                $(
"#feed_content_" + ingId).append(content);
            }
        },
        error: 
function(xhr) {
            $(
"#feed_content_" + ingId).append(xhr.responseText);
        }
    });
}

function GetRecentFeed(feedListType, appId) {
    
var itemcount = 30;
    $.ajax({
        url: 
'/WebService/FeedService.asmx/GetRecentFeed',
        data: 
'{feedListType:' + feedListType + ',appId:"' + appId + '",itemcount:' + itemcount + '}',
        type: 
'post',
        dataType: 
'json',
        contentType: 
'application/json; charset=utf-8',
        cache: 
false,
        success: 
function(data) {
            
if (data.d) {
                $(
"#feed_list").html(data.d);
            }
            
else {
                $(
"#feed_list").html("<br /><span class='text_gray'>还没有动态,去看一下 <a href='/feed/all/'>全站</a> 的吧 :-)</span>");
            }
        },
        error: 
function(xhr) {
            $(
"#feed_list").html(xhr.responseText);
        }
    });
    $.ajax({
        url: 
'/WebService/FeedService.asmx/GetFeedCount',
        data: 
'{feedListType:' + feedListType + ',appId:"' + appId + '"}',
        type: 
'post',
        dataType: 
'json',
        contentType: 
'application/json; charset=utf-8',
        cache: 
false,
        success: 
function(data) {
            
if (data.d > itemcount) {
                
var url = pageUrl.replace("{0}"2); //jQuery.queryString(location.href, "page=2");
                $("#feed_more_block").html('<a href="' + url + '">更多动态</a>');
            }
        }
    });
}

function SetFeedRefreshStaus() {
    
var height = $("#feed_list").height();
    $(
'#feed_list').html('<li class="feed_loading" id="feed_loading_block">更新中...</li>');
    $(
"#feed_loading_block").css("height", height);
}

function GetLoginInfo(returnUrl) {
    $.ajax({
        url: 
'/WebService/UserService.asmx/GetLoginInfo',
        data: 
'{returnUrl:"' + returnUrl + '"}',
        type: 
'post',
        dataType: 
'json',
        contentType: 
'application/json; charset=utf-8',
        cache: 
false,
        success: 
function(data) {
            $(
"#header_userinfo").html(data.d);
        }
    });
}

function HideTip() {
    
if ($("#txt_ing").val() == "你在做什么?你在想什么?") {
        $(
"#txt_ing").val("");
        $(
"#txt_ing").css("color""#222");
        $(
"#txt_ing").css("font-size""14px");
    }
}
function IngIsEmpty() {
    
if ($("#txt_ing").val() == "") {
        $(
"#txt_ing").css("color""#BBB");
        $(
"#txt_ing").css("font-size""12px");
        $(
"#txt_ing").val("你在做什么?你在想什么?");
    }
}





function ShowCurrentUser() {
    $.ajax({
        url: 
'/WebService/UserService.asmx/GetCurrentUser',
        data: 
'{}',
        type: 
'post',
        dataType: 
'json',
        contentType: 
'application/json; charset=utf-8',
        cache: 
false,
        success: 
function(data) {
            
if (data.d) {
                $(
"#lnk_current_user").attr("href""http://home.cnblogs.com/" + data.d["Alias"+ "/");
                $(
"#lnk_current_user").attr("title", data.d["DisplayName"]);
                $(
"#img_current_avatar").attr("src", data.d["IconName"]);
                $(
"#img_current_avatar").attr("alt", data.d["DisplayName"]);
                $(
"#img_current_avatar").show();
                $(
"#ing_current").html(data.d["LastIng"]);
                $(
"#publish_block").show();
            }
            
else {
                $(
"#banner_default").show();
            }
        }
    });
}

 

 

最后跑出来就是这个效果...

 

posted @ 2009-12-10 14:32  Tmac_  阅读(203)  评论(0)    收藏  举报