小编zac*_*ryc的帖子

Chrome中嵌套了nth-child的querySelector似乎不起作用

我一直在寻找在第n个子选择器中使用nth-child来查找元素.这似乎适用于Firefox,但似乎不适用于chrome.这是我的测试文件:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8" />
    <title>untitled</title>
    <!--[if IE]>
        <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->

    <script type="text/javascript" charset="utf-8">
        myFunc = function() {
            if(document.querySelector('#wonderful DIV:nth-child(2) DIV:nth-child(2)')) {
                alert("found the element");
            } else {
                alert("element not found");
            }
        };
    </script>
</head>
<body onLoad="myFunc()">

    <div id="wonderful">
       <div>
       </div>
       <div >
           <div>
           </div>
           <div class="blue">
               find me!
           </div>
       </div>
    </div>

</body>
</html>
Run Code Online (Sandbox Code Playgroud)

还有其他人看过这个问题吗?有办法解决这个问题吗?

css google-chrome css-selectors

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

ASP.Net应用程序之外的MailDefinition

我正在寻找一个C#控制台应用程序,它将在运行发送电子邮件的过程中.我只是通过做类似的事情来发送电子邮件:

     MailMessage message = new MailMessage("foo@foo.com", "bar@bar.com", "Test message", "Test message content");
     message.IsBodyHtml = true;
     message.Body = "<a href=\"http://www.daringfireball.net\">DaringFireball.net</a>";
     SmtpClient client = new SmtpClient("localhost"); // Your host here

     try
     {
        client.Send(message);
     }
     catch (Exception e)
     {
        Console.WriteLine("There was an error trying to send the message: " + e.ToString());
     }
Run Code Online (Sandbox Code Playgroud)

我试图用MailDefinition找到一种方法,因为这些电子邮件可能会更长,但在这样做的过程中我遇到了一个小问题.CreateMailMessage方法需要一个我没有的System.Web.UI.Control,因为我不是ASP.Net应用程序.

有没有人遇到这个问题?或者找到了更好的方法吗?

谢谢

c#

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

标签 统计

c# ×1

css ×1

css-selectors ×1

google-chrome ×1