HTML中的大括号 [英] Curly brackets in HTML

查看:1003
本文介绍了HTML中的大括号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我偶然发现了这段代码:

 < a href =#class =text1{text2}> ; ...< / A> 

{text2} 是做什么的?后来,这个HTML被替换为:

 < a href =#class =text1{text2} style> ; ...< / A> 

有没有办法检索 text2 value with jQuery?

解决方案

在某些情况下,输入代码时,脚本实际上可以轻松识别该行。或者在某些情况下可以作为数据库检索和存储数据的指示器。



或者它可能是无效的标记,如果该人知道什么他们在做。



但没有任何其他信息或变量,很难说。但最常见的是在Php,Javascript甚至C#中访问脚本。因为他们可以解析HTML文档并对其进行处理。 如果使用这些大括号,并且它不正确,则会导致解析错误。



希望能够澄清它。






更新:

找到它。它是Javascript的一种形式。你可以实现如下的东西:

  $(function(){
var foundString = $('*:contains ({text1})');
});

有大量的数据可以解决这个问题。 b

I stumbled upon this code:

<a href="#" class="text1"{text2}>...</a>

What does the {text2} do? Later on, this HTML is replaced with:

<a href="#" class="text1" {text2} style>...</a>

Is there a way I can retrieve the text2 value with jQuery?

解决方案

In some cases that code is input in, so scripts can actually easily identify a the line. Or in some cases can be an indicator for a database to retrieve and store data once it has been pulled.

Or it could be invalid markup, doubtful if the person knows what they are doing.

But without any other information or variables it is hard to say. But the most common is access for scripts within Php, Javascript, and even C#. Cause they can parse the HTML document and manipulate it. If those braces are used, and it is incorrectly it will cause a parse error.

Hopefully that sort of clarifies it.


Update:

Yes, jQuery can find it. It is a form of Javascript. You could implement something such as:

$(function() {
    var foundString = $('*:contains("{text1}")');
});

There is a vast amount of data that addresses this for more detail.

这篇关于HTML中的大括号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆