小编Ste*_*ven的帖子

jQuery高亮表行

我需要在鼠标上突出显示一个表格行.看起来很容易做到,对吧?特别是使用jQuery.但是,唉,我不是那么幸运.

我已经测试了不同的解决方案来突出表格行,但似乎没有任何工作:-(

我测试了以下脚本:

// TEST one    
jQuery(document).ready(function() { 

  jQuery("#storeListTable tr").mouseover(function () { 
    $(this).parents('#storeListTable tr').toggleClass("highlight"); 
    alert('test'); // Just to test the mouseover event works
  }); 

});

//TEST 2
jQuery(document).ready(function() { 

   $("#storeListTable tbody tr").hover( 
     function() {  // mouseover 
          $(this).addClass('highlight'); 
     }, 
     function() {  // mouseout 
          $(this).removeClass('highlight'); 
     } 
   );
});
Run Code Online (Sandbox Code Playgroud)

这是我的HTML代码

<html> 
  <head> 
  <title>Title</title> 
  <link rel="stylesheet" href="css/storeLocator.css" type="text/css" 
media="screen" charset="utf-8" /> 
  <script type="text/javascript" src="js/jquery.js" charset="utf-8"></ 
script> 
  </head> 
  <body> 

<table id="storeListTable"> 
    <thead> 
      <tr class="even"> 
        <th>ID</th> 
        <th>Navn</th> 
        <th>E-post</th> 
        <th>Nettside</th> 
      </tr> 
    </thead> 
    <tbody> 
      <tr class="" id="store1"> 
        <td>10</td> …
Run Code Online (Sandbox Code Playgroud)

wordpress jquery

5
推荐指数
3
解决办法
3万
查看次数

使用 Google 地图进行邻近搜索

我正在开发一个商店位置应用程序。

查找商店时,它目前会根据地址和邮政编码在谷歌地图中显示位置。

现在我想建立一个功能,还可以显示半径 500 米内的其他商店。为此,我必须进行邻近搜索/计算。

我最大的问题是我应该如何处理这个问题。

我确实找到了这个链接,其中有一些示例代码。但我不确定我是否可以使用该代码(以及我应该使用哪些代码)。有人有更好的例子吗?

另外,我正在考虑向数据库添加一个新表,该表存储每个商店的地理代码。我是否需要比 'id'、'latitude' 和 'longitude' 更多的字段?

更新
我刚刚在 phpro.org 上找到了这个链接。看来这正是我所需要的!有人使用过他们的例子并可以对此发表评论吗?

php google-maps geocoding proximity

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

压缩脚本时,JavaScript停止工作

我想压缩我的2000多行javascript,并测试了http://dean.edwards.name/packer/http://closure-compiler.appspot.com/home.

但在这两种情况下,压缩脚本都会给我带来错误.错误的一个例子是jQuery(document).Da is not a function.

为什么我的脚本在优化后不起作用?我该怎么做才能优化/压缩我的脚本?

javascript optimization jscompress

5
推荐指数
2
解决办法
1380
查看次数

需要帮助使用itextsharp从HTML创建PDF

我正在尝试从HTML页面中创建PDF.我正在使用的CMS是EPiServer.

到目前为止这是我的代码:

    protected void Button1_Click(object sender, EventArgs e)
    {
        naaflib.pdfDocument(CurrentPage);
    }


    public static void pdfDocument(PageData pd)
    {
        //Extract data from Page (pd).
        string intro = pd["MainIntro"].ToString(); // Attribute
        string mainBody = pd["MainBody"].ToString(); // Attribute

        // makae ready HttpContext
        HttpContext.Current.Response.Clear();
        HttpContext.Current.Response.ContentType = "application/pdf";

        // Create PDF document
        Document pdfDocument = new Document(PageSize.A4, 80, 50, 30, 65);
        //PdfWriter pw = PdfWriter.GetInstance(pdfDocument, HttpContext.Current.Response.OutputStream);
        PdfWriter.GetInstance(pdfDocument, HttpContext.Current.Response.OutputStream);  

        pdfDocument.Open();
        pdfDocument.Add(new Paragraph(pd.PageName));
        pdfDocument.Add(new Paragraph(intro));
        pdfDocument.Add(new Paragraph(mainBody));
        pdfDocument.Close();
        HttpContext.Current.Response.End();
    }
Run Code Online (Sandbox Code Playgroud)

这将输出文章名称,简介和主体的内容.但它没有解析文章文本中的HTML,也没有布局.

我试过看看http://itextsharp.sourceforge.net/tutorial/index.html,而不是更聪明.

任何指向正确方向的指针都非常感谢:)

.net c# itextsharp

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

为什么我得到这个System.NullReferenceException?

我收到了一个奇怪的错误.我有以下前端代码:

<%@ Page Title="" Language="C#" MasterPageFile="~/nokernok/MasterPages/nokernok.Master" AutoEventWireup="true" CodeBehind="articleList.aspx.cs" Inherits="development.nokernok.articleList" %>
<%@ Register TagPrefix="EPiServer" Namespace="EPiServer.WebControls" Assembly="EPiServer" %>

<asp:Content ID="Content2" ContentPlaceHolderID="LeftContentPlaceHolder" runat="server">    
    <asp:Label ID="lblTest" runat="server" />    
</asp:Content>
Run Code Online (Sandbox Code Playgroud)

我有以下后端代码:

using System;
using System.Web;
using EPiServer;
using EPiServer.Core;
using development.NaafLibrary;

namespace development.nokernok
{
    public partial class articleList : TemplatePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            lblTest.Text = "TEEEEEEEEEEEST";    
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

设计师档案:

namespace development.nokernok {
    public partial class articleList {        
       protected global::System.Web.UI.WebControls.Label lblTest;
    }
}
Run Code Online (Sandbox Code Playgroud)

我得到这个错误消息:

Object reference not set to an …
Run Code Online (Sandbox Code Playgroud)

.net c# asp.net nullreferenceexception

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

增加发票ID的最佳方法是什么?

我正在使用PHP和MySQL开发一个简单的发票系统.
我最初的想法是使用ID(自动递增)作为发票ID.但那不行.

当用户向我的付款服务提供商提交订单时,会创建临时发票.如果交易失败,我需要删除临时发票.

问题是发票已经创建并给出了ID和 - 根据法律规定,我不允许删除任何已发给发票号的发票.所以我需要添加另一列'invoice_id'并在成功交易后添加ID.

多个用户可以同时进行购买.

我的问题是,如何确保检索上次创建的发票ID并增加此值?

我应该使用$_SESSION[]存储invoice_id吗?或者我应该从数据库中检索最新的ID?如果从DB检索,我应该锁定此事务的表吗?

任何指导非常感谢.

php mysql business-logic

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

我应该在网站上使用相对 URL 还是绝对 URL?

如果我不移动我的网站,有什么好的理由说明为什么我应该使用绝对 URL 而不是相对 URL?

html hyperlink

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

是否可以排除一个特定 div 容器的所有 css 样式?

font-face在我的网站上使用时遇到问题。在使用它自己的样式的 html 文件上测试它时,我可以让它工作,但如果我包含其他样式表,则不能。

我试过覆盖 stles,以不同的顺序放置样式表等等,但没有任何效果。

所以我想知道,是否可以排除所有 CSS 并仅将一个 css 文件中的 css 用于特定 div 容器?

(不使用iframe

html css

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

尝试将星号添加到所需的输入字段

我不认为我完全明白:before,:after因为我无法让这个工作.我只是想在表单中的必填字段后添加星号.

我的代码很简单:

<input id="name" type="text" required="required" autofocus="" placeholder="Name" autocomplete="off" value="" maxlength="40" class="required" name="name" />

/* Required field */
.required:after {
  content: '*';
  color: #EF5F5F;
}
Run Code Online (Sandbox Code Playgroud)

为什么这不起作用?
我的小提琴:http://jsfiddle.net/3EFTN/

html css

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

使用javascript/jQuery添加类时,为什么css过渡不起作用?

我有一个消息框,我想在点击时向下滑动.我通过Angular添加一个css类(在我的例子中使用jQuery)来实现这一点.但是我的CSS转换没有生效.

我在做什么明显的错误?

这是我的小提琴:http://jsfiddle.net/mBKXn/

和我的代码:

// jQuery
$('.test').on('click',function(){
  $('#msgContainer').toggleClass('msgShow');
});

// HTML
<div class="container">
    <div id="msgContainer" class="msg">
        <p>Message here</p>
        <p>T2</p>
        <p>T4</p>
    </div>
    Test text
</div>

<button class="test">Click</button>

// CSS
.container{
    position: relative;
    height: 200px;
    width: 400px;
    border: solid 1px #222;
}

.msg{
    position: absolute;
    top: 0;
    background-color: #FEEFB3;
    height: 0;
    width: 100%;
    overflow: hidden;
    -webkit-transition: height 0.8s linear;
    -moz-transition: height 0.8s linear;
    -o-transition: height 0.8s linear;
    -ms-transition: height 0.8s linear;
    transition: height 0.8s linear;    
}

.msgShow{
    height: auto; …
Run Code Online (Sandbox Code Playgroud)

javascript jquery css-transitions angularjs

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