小编Sor*_*ora的帖子

jQuery Tag-It! - 如何更改焦点边框

我正在使用jQuery Tag-It!在我的项目中.我希望在onfocus事件触发时使对象的边框可见,但我无法使其工作.

我的代码:

<ul id="TagsDesc" name="nameOfSelect" runat="server" ></ul>

<script type="text/javascript">
   $(document).ready(function () {
      $('#<%=TagsDesc.ClientID %>').focus(function () {
         $(this).css("border", "1px solid");
      });

      $('#<%=TagsDesc.ClientID %>').tagit({ 
        'maxTags': 10,'minLength': 1,
        'maxLength': 12,
        'tagsChanged': showTags
      });

      function showTags() {
         var tags = $('#<%=TagsDesc.ClientID %>').tagit("tags");
         var tagsContainer = $('#<%=tagsContainer.ClientID %>');
         var res = '';
         for (var i in tags)
            res += ',' + tags[i].value;
         tagsContainer.val(res);
      }
   });
</script>
Run Code Online (Sandbox Code Playgroud)

有什么好主意吗?

css jquery tag-it

2
推荐指数
1
解决办法
1059
查看次数

更改window.beforeunload消息

我想知道我是否可以更改window.beforeunload消息.互联网上的所有示例都与此类似:

$(window).bind('beforeunload', function() {
    return 'You have unsaved changes. If you leave the page these changes will be lost.';
});
Run Code Online (Sandbox Code Playgroud)

这很酷,在Google Chrome中我的信息会显示,但在Firefox中会显示默认信息.我如何欺骗Firefox显示我的消息而不是默认消息?

javascript jquery

2
推荐指数
1
解决办法
3670
查看次数

Replace the last character of a string in c#

I have this string :

 string lat ="24.6669863852163";
Run Code Online (Sandbox Code Playgroud)

how can I replace the last Character '3' by '2' ?

.net c# string replace substring

2
推荐指数
1
解决办法
1万
查看次数

从dataTable中删除包含空值的行

我有一个包含7800行的DataTable,每行包含3列,如果第二列为null,则可能有Null值我正在删除整行,问题是即使我删除行,DataTable仍然包含相同数量的行号码愿望是7800

代码 :

 string query = "Select STORE_NAME, STORE_LATITUDE, STORE_LONGTITUDE "
  +" From stores inner join contact_information on stores.STORE_ID=contact_information.CONTACT_ID "
    +" where CONTACT_TYPE_ID=1 "
      +" AND CONTACT_COUNTRY_ID="+Country
         +" AND CONTACT_CASA_ID="+Casa
            +" AND CONTACT_TOWN_ID="+Town;
    DataTable dt = new SQLHelper(SQLHelper.ConnectionStrings.KernelConnectionString).getQueryResult(query);
    dt = removeNullColumnFromDataTable(dt);
Run Code Online (Sandbox Code Playgroud)

功能 :

    public static DataTable removeNullColumnFromDataTable(DataTable dt)
   {
    for (int i = dt.Rows.Count - 1; i >= 0; i--)
      {
       if (dt.Rows[i][1].ToString() == null)
           dt.Rows[i].Delete();
      }
     return dt;
   }
Run Code Online (Sandbox Code Playgroud)

c# datatable

2
推荐指数
1
解决办法
2万
查看次数

HTML Agility Pack tr 在表格末尾插入

我有这张桌子

<div id="ConversationDIv" runat="server">
   <table border="1" id="tbl">
       <tr>
          <td>blah blah</td>
       </tr>
   </table>
</div>
<asp:Button id="Insert" onCLick="Insert_Click" Text="addNew" ></asp:Button>
Run Code Online (Sandbox Code Playgroud)

C# :

protected void Insert_Click(object sender,EventArgs e)
{
    var html = new HtmlAgilityPack.HtmlDocument();

    html.LoadHtml(ConversationDIv.InnerHtml);

    var table = html.DocumentNode.SelectNodes("table").FirstOrDefault();
    // how can I add a new row to table ?
}
Run Code Online (Sandbox Code Playgroud)

我想在表中添加新行,我该怎么做?

c# html-agility-pack

2
推荐指数
1
解决办法
3131
查看次数

html5画布中的碰撞检测

我正在尝试构建一个游戏,用户应该将圆圈放在垂直条中,但我在碰撞检测功能方面遇到了麻烦.这是我的jsfiddle:http://jsfiddle.net/seekpunk/QnBhK/1/

 if (collides(Bluecircle, longStand)) {
    Bluecircle.y = longStand.y2;
    Bluecircle.x = longStand.x2;
 }
 else if (collides(Bluecircle, ShortStand)) {
    Bluecircle.y = ShortStand.y2;
    Bluecircle.x = ShortStand.x2;
 }
function collides(a, bar) {
   return a.x == bar.x1 && a.y == bar.y1;
}
Run Code Online (Sandbox Code Playgroud)

javascript jquery html5 canvas collision-detection

2
推荐指数
1
解决办法
1万
查看次数

在光标位置的内容可编辑div中添加图像标记

我有一个contentEditablediv和一个emojies图像列表.我要做的是当用户点击图像时,应该在光标位置插入图像标签.

我厌倦了这样做,但这段代码只在div的末尾插入图像,这对我来说并非如此

$("#editable").append($(this).id); // $(this) is the image tag
Run Code Online (Sandbox Code Playgroud)

我该如何解决我的问题?jsfiddle:http://jsfiddle.net/7VNTn/

javascript jquery

2
推荐指数
1
解决办法
1814
查看次数

使用光标事件缩放图像的选定部分

我有这个jsfiddle:http://jsfiddle.net/seekpunk/JDU9f/1/

我想要的是,当用户进行选择时,所选部分会放大。有什么办法可以实现这一点吗?

这是到目前为止的代码:

  var canvas = document.getElementById("MyCanvas");
    var ctx = canvas.getContext('2d'),
        w = canvas.width,
        h = canvas.height,
        x1,
        y1,
        isDown = false;
    var img = new Image();
    img.src = "http://www.stockfreeimages.com/static/homepage/female-chaffinch-free-stock-photo-106202.jpg";
    canvas.onmousedown = function (e) {
        var rect = canvas.getBoundingClientRect();
        x1 = e.clientX - rect.left;
        y1 = e.clientY - rect.top;
        isDown = true;
    }
    canvas.onmouseup = function () {
        isDown = false;
    }
    canvas.onmousemove = function (e) {

        if (!isDown) return;

        var rect = canvas.getBoundingClientRect(),
            x2 = e.clientX - rect.left, …
Run Code Online (Sandbox Code Playgroud)

javascript jquery

2
推荐指数
1
解决办法
2361
查看次数

更新面板里面的jquery对话框div不工作

这是我的代码:

 <div id="AddFriendDiv" style="display: none">
        <asp:TextBox ID="FriendParamtxt" runat="server"></asp:TextBox>
        <asp:UpdatePanel ID="upd" runat="server">
        <Triggers>
        <asp:AsyncPostBackTrigger ControlID="SearchFriend_btn" EventName="Click" />
        </Triggers>
          <ContentTemplate>
                <asp:Button ID="SearchFriend_btn" runat="server" OnClick="SearchFriend_btn_Click" Value="Search" />
                <asp:Repeater ID="FriendRequestRepeater" runat="server">
                    <ItemTemplate>
                        <table border="1">
                            <tr>
                                <td>
                                    <img src='<%#Eval("PROFILE_PIC") %>' width="35px" height="35px" alt='<%#Eval("NAME") %>' />
                                </td>
                                <td>
                                    <asp:Label ID="Name_lbl" runat="server" Text='<%#Eval("NAME") %>'></asp:Label>
                                </td>
                                <td>
                                    <input type="hidden" id="requestFriendID_hf" /><input type="button" id="addFreind"
                                        value="Send Request" />
                                </td>
                            </tr>
                        </table>
                    </ItemTemplate>
                </asp:Repeater>
            </ContentTemplate>
        </asp:UpdatePanel>
    </div>
Run Code Online (Sandbox Code Playgroud)

客户端 :

 function SendFriendRequest() {

        var dialogOption = { title: "<u>Add Friend</u>", width: 280, …
Run Code Online (Sandbox Code Playgroud)

javascript c# jquery

1
推荐指数
1
解决办法
8113
查看次数

使用css动画spriteesheet

我在使用css动画制作spritesheet时遇到麻烦每个例子我看到包含一个只有1行精灵或1列的精灵表,如下所示:在此输入图像描述

然后他们使用动画制作动画 keyframes

@keyframes play {
100% { background-position: -1900px; }
}
Run Code Online (Sandbox Code Playgroud)

但对我来说,spritesheet是一个10x8的网格

他们无论如何使用css为这个特殊的spritesheet实现动画?或者我应该使用HTML5画布?

每帧为90x96像素

这是我的形象

在此输入图像描述

html javascript css html5

1
推荐指数
1
解决办法
718
查看次数