小编San*_*530的帖子

CSS:不属性

我有几个HTML表.这些表没有CSS类.这两个表有width="100%"属性.其他表没有该width属性.

仅使用CSS我需要设置没有的表的宽度width=100%.像这样的东西:

table:not(width="100%"){
    width: myValue;
}
Run Code Online (Sandbox Code Playgroud)

html css css-selectors

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

正则表达式替换html标记之外的文本

我有这个HTML:

"This is simple html text <span class='simple'>simple simple text text</span> text"
Run Code Online (Sandbox Code Playgroud)

我只需匹配任何HTML标记之外的单词.我的意思是如果我想匹配"简单"和"文本"我应该只从"这是简单的html文本"得到结果,最后一部分"文本" - 结果将是"简单"1匹配,"文本"2火柴.任何人都可以帮我这个吗?我正在使用jQuery.

var pattern = new RegExp("(\\b" + value + "\\b)", 'gi');

if (pattern.test(text)) {
    text = text.replace(pattern, "<span class='notranslate'>$1</span>");
}
Run Code Online (Sandbox Code Playgroud)
  • value 是我想要匹配的单词(在这种情况下"简单")
  • text"This is simple html text <span class='simple'>simple simple text text</span> text"

我需要将所有选定的单词(在本例中为"简单")包装起来<span>.但我想只包装任何 HTML标签之外的单词.这个例子的结果应该是

This is <span class='notranslate'>simple</span> html <span class='notranslate'>text</span> <span class='simple'>simple simple text text</span> <span class='notranslate'>text</span>
Run Code Online (Sandbox Code Playgroud)

我不想替换里面的任何文字

<span class='simple'>simple simple text text</span>
Run Code Online (Sandbox Code Playgroud)

它应该与更换前相同.

html regex replace

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

Jquery .style未定义

我的页面中有很多表格.一些表具有内联定义的Width属性 -

style="width:100%; ..."
Run Code Online (Sandbox Code Playgroud)

我需要得到所有这些表格.我试过了

$('.Forum_Container table').each(function () {
    var $this = $(this);
    if ($this.style != undefined) {
        if ($this.style.width == '100%') {
            ...
        }
    } else {
        ...
    }
});
Run Code Online (Sandbox Code Playgroud)

但是$ this.style总是未定义的.什么可能导致这个问题?

jquery styles undefined

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

如何确定Google翻译已加载?

我的页面上有Google翻译.它看起来像一个下拉列表,但我页面上的所有其他下拉列表都有另一种样式.所以我创建了jQuery函数,它改变了Google Translator下拉列表样式.此函数添加或删除一些样式参数.我想知道什么时候应该调用这个函数?在当前的代码中,我在3秒后调用它.在document.ready之后

  $(document).ready(function () {
      setTimeout(wrapGoogleTranslate, 3000);
  });
Run Code Online (Sandbox Code Playgroud)

目前的情况是我隐藏了Google翻译所在的Div,并在我的功能更正其样式后显示它.这意味着我的页面加载,然后等待3秒,然后 Google翻译出现更正的样式.

我想知道如何确定Google Translate下拉列表已加载,然后调用我的函数来更改样式.我不想让用户等待3秒钟(可能在某些情况下谷歌翻译会加载超过3秒,然后我的功能永远不会被执行).

javascript jquery events load

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

以编程方式设置maxRequestLength

有一个名为的配置值maxRequestLength.在配置文件中,它看起来像这样:

<configuration>
  <system.web>
    <httpRuntime maxRequestLength="2048576" />
  </system.web>
</configuration>
Run Code Online (Sandbox Code Playgroud)

如何以maxRequestLength编程方式设置值?

.net request

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

Google翻译排除字词

我在我们的网站上有谷歌翻译.我想阻止翻译中的一些单词和短语.是否可以创建一些非翻译单词和单词组合列表?

words google-translate

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

Web.config - 使用应用程序 requestLimits

我有一个页面,用户可以在其中将文件上传到服务器。我指定了

    <security>
        <requestFiltering>
            <requestLimits maxAllowedContentLength="512000"></requestLimits>
        </requestFiltering>
    </security>
Run Code Online (Sandbox Code Playgroud)

在我的 Web.config 中,但我仍然收到请求太大的错误。我找到了一种解决方案 - 更改系统文件 applicationHost.config。我设置

<requestLimits maxAllowedContentLength="512000000">
Run Code Online (Sandbox Code Playgroud)

它解决了我的问题。但是我们不能在开发服务器上修改这个文件。我找到了一些解决方案,例如使用

<clear/>
Run Code Online (Sandbox Code Playgroud)

或者

<remove name="..."> 
Run Code Online (Sandbox Code Playgroud)

在我的 Web.config 中

    <security>
        <requestFiltering>
            <clear/>
            <requestLimits maxAllowedContentLength="512000"></requestLimits>
        </requestFiltering>
    </security>
Run Code Online (Sandbox Code Playgroud)

但现在我明白了

HTTP Error 500.19 - Internal Server Error
The requested page cannot be accessed because the related configuration data for the page is invalid.
Run Code Online (Sandbox Code Playgroud)

web-config request limit

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

ASP.Net文字.插入HTML

我的页面上有简单的文字.

<asp:Literal ID="litDescription" runat="server"></asp:Literal>
Run Code Online (Sandbox Code Playgroud)

当我尝试将以下文本设置为文字时:

<p><div>Some Text</div></p>
Run Code Online (Sandbox Code Playgroud)

在我的浏览器标记中,我看到了

<p></p>
    <div>Some Text</div>
<p></p>
Run Code Online (Sandbox Code Playgroud)

为什么有两个'p'标签?我需要

<p><div>Some Text</div></p>.
Run Code Online (Sandbox Code Playgroud)

html asp.net literals

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