Using the jQuery HTML method, this message is set to be the HTML for a DOM element the ID “message.”通过调用jQuery操作HTML的相关方法,可以生成一个DOM元素(ID为“message.”开头)将此条消息显示在HTML页面中。个人理解,ID “message.”是指以message.开头,例如message.xxxx,而不是指ID就是message.
补充:参考了楼上一些朋友的翻译,有人把jQuery HTML method翻译成jQuery的HTML方法,即html()。我对jQuery不熟,但我觉得这段话不太可能是表达这样的意思,因为一个方法通常不会是纯大写的,英文中如果要说html()方法,会写成jQuery html method,其中的html是小写(且多半会采用斜体等有别于其他内容的字体),所以我说这句话的意思应该是指jQuery中提供的用来操作HTML的方法,或者特指其中用来创建DOM元素的方法。 具体是什么,可能需要熟悉jQuery的人来回答,或者楼主可以结合原文的上下文来确定。
上面有段代码: For example: <script type=”text/javascript”> $(function () { var message = ‘Hello @ViewBag.Username; $(“#message”).html(message).show(‘slow’); }); </script> Using the jQuery HTML method, this message is set to be the HTML for a DOM element the ID “message.” Even though the user name is HTML encoded within the message string, there is still a potential XSS vulnerability. For example, if someone supplies the following as their user name, the HTML will be set to a script tag that will get evaluated.
Using the jQuery HTML method, this message is set to be the HTML for a DOM element the ID “message.” 通过jQuery的操作HTML的方法(这时特指html()),这个message(字符串变量)被设置为一个带有id="message"的DOM元素的HTML内容。
这样好理解些: Using the jQuery HTML method, this message is set to be the HTML for a DOM element with the ID “message.”
具体是什么,可能需要熟悉jQuery的人来回答,或者楼主可以结合原文的上下文来确定。
For example:
<script type=”text/javascript”>
$(function () {
var message = ‘Hello @ViewBag.Username;
$(“#message”).html(message).show(‘slow’);
});
</script>
Using the jQuery HTML method, this message is set to be the HTML for a DOM element the ID “message.” Even though the user name is HTML encoded within the message string, there is still a potential XSS vulnerability. For example, if someone supplies the following as their user name, the HTML will be set to a script tag that will get evaluated.
通过jQuery的操作HTML的方法(这时特指html()),这个message(字符串变量)被设置为一个带有id="message"的DOM元素的HTML内容。
Using the jQuery HTML method, this message is set to be the HTML for a DOM element with the ID “message.”