Bra*_*don 8 html javascript c# asp.net
我正在浏览一个我接管的网站,并在其中一个页面中看到了这一部分:
<a href="javascript:window.location='<%=GetSignOutUrl()%>';">
// img
</a>
Run Code Online (Sandbox Code Playgroud)
显然,任何曾经使用过没有javascript网站的人都无法正常退出(令人惊讶的是,这种情况从未出现过).
所以首先想到的是
<a href="<%=GetSignOutUrl()" onclick="javascript:window.location='<%=GetSignOutUrl()%>';">
// img
</a>
Run Code Online (Sandbox Code Playgroud)
Then I realized I don't know why I'm keeping the javascript call around at all. I'm just a little confused as to why it would have been written like that in the first place when a regular link would have worked just fine. What benefit does window.location have over just a regular link?
This is also the only place in the website I've seen something like this done (so far).
Edit: The programmer before me was highly competent, which is actually why I was wondering if there was something I wasn't taking into account or if he just made a simple oversight.
有以下三种可能:
我会把它拆下来,看看它是否破裂。但话又说回来,我是一个墨守成规的人。
| 归档时间: |
|
| 查看次数: |
610 次 |
| 最近记录: |