什么是“javascript:”用于,是否符合要求? [英] What is "javascript:" used for, and is it compliant?

查看:100
本文介绍了什么是“javascript:”用于,是否符合要求?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是javascript:用于,是否合规,我应该使用它吗?

What is javascript: used for, and is it compliant and should I use it?

我注意到我的一些同事选择使用

I noticed that some of my associates choose to use

javascript: 

后跟一些函数名称或一些javascript代码。但对我来说似乎没必要。

followed by some function name or some javascript code. But it seems unnecessary to me.

我在事件处理程序中看到了很多,比如

I see this a lot in event handlers like

onclick="javascript: somefunction451();"

此外,我无法搜索有关javascript的更多信息:因为它说我正在尝试做跨站脚本。特别是如果我把它粘在引号中。这件事根本无法修复吗?我应该只在闪存中搜索一下还是只用Silverlight浏览器?

Also I have trouble searching for more information on javascript: because it says that I'm trying to do cross site scripting. Especially if I stick it in quotes. Is this something that simply can't be fixed? Should I search this in a flash only or silverlight only browser?

推荐答案

在onfoo属性值中完全没有必要。在这种情况下,它被解释为 标签 通过JavaScript解析器。因此它不是错误的,但它没用。

It's completely unnecessary in "onfoo" attribute values. In that context, it's interpreted as a label by the JavaScript parser. Thus it's not erroneous, but it's useless.

在href值中,它有一个角色,但无论如何都没有理由使用JavaScripthref值。

In "href" values, it has a role, but there's really no reason for JavaScript "href" values anyway.

这篇关于什么是“javascript:”用于,是否符合要求?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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