无法在ASP.net文档的onload属性中使用"this" [英] Can't use 'this' in onload property in an ASP.net document
问题描述
我正像通常那样尝试异步加载样式表,但是我正在为正在工作的ASP.net网站上遇到麻烦.我不断收到以下错误:
I'm trying to load my stylesheets asynchronously, as I usually do, but I'm running in to trouble on an ASP.net site I'm working on. I keep getting the following error:
编译器错误消息:BC30456:'this'不是'ASP.tools_controls_homepage_master'的成员.
Compiler Error Message: BC30456: 'this' is not a member of 'ASP.tools_controls_homepage_master'.
当我尝试使用类似以下< link>
标记中的onload值时,就会发生这种情况:
This is occuring when I try to use an onload value like in the following <link>
tag:
<link rel="preload"
href="//maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css"
as="style" onload="this.rel='stylesheet'" />
我对ASP.net的工作方式不是很熟悉,但是我确实知道如果这个问题是用VB编写的.任何帮助使此工作正常进行的工作将不胜感激.
I'm not very familiar with how ASP.net works, but i do know this site was written with VB if that matters. Any help getting this working would be greatly appreciated.
推荐答案
使用 OnClientLoad
属性,按照我想要的方式进行此工作,例如:
Got this working the way I wanted with the OnClientLoad
property, like so:
<link rel="preload" href="//maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css" as="style" OnClientLoad="this.rel='stylesheet'" />
似乎在每个浏览器中都能正常工作.
Seems to be working properly in every browser.
这篇关于无法在ASP.net文档的onload属性中使用"this"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!