是什么意思?-Whatdoesmean?" /> 是什么意思?-Whatdoesmean?" /> 是什么意思?-Whatdoesmean?" />
当前位置:  开发笔记 > 编程语言 > 正文

是什么意思?-Whatdoesmean?

Inmyhtmlpage,Iseealinkwhoseviewsourcecodeisasbelow:在我的html页面中,我看到一个链接,其“查看源代码”代码如下

In my html page, I see a link whose 'view source' code is as below :

在我的html页面中,我看到一个链接,其“查看源代码”代码如下:


I see a valid link when I hover my mouse on it and when I click it, it works. But I am not able to find where and how this URL gets generated. I found the class a.view being defined in one of the CSS, but couldn't find the URL in the page source.. Can somebody help me out on whr i can find this URL ?

当我将鼠标悬停在它上面时,我看到了一个有效的链接,当我点击它时,它就生效了。但是我不能找到这个URL是如何生成的。我找到了a班。视图被定义在一个CSS中,但是在页面源中找不到URL。谁能帮我找到这个URL ?

5 个解决方案

#1


43  

I felt like replying as well, explaining the same thing as the others a bit differently. I am sure you know most of this, but it might help someone else.

我感觉自己也在回答,解释和其他人一样的事情有点不同。我相信你知道其中的大部分,但它可能会帮助别人。


The

href="#"

part is a commonly used way to make sure the link doesn't lead anywhere on it's own. the #-attribute is used to create a link to some other section in the same document. For example clicking a link of this kind:

part是一种常用的方法,以确保链接不会在自己的任何地方产生。#-属性用于在同一文档中创建指向其他部分的链接。例如点击此类链接:

Go to news

will take you to wherever you have the

会带你去哪里?


code. So if you specify # without any name like in your case, the link leads nowhere.

代码。因此,如果您指定#没有任何名称,例如在您的例子中,链接不会导致任何结果。

The

class="view"

part gives it an identifier that CSS or Javascript can use. Inside the CSS-files (if you have any) you will find specific styling procedures on all the elements tagged with the "view"-class.

部分给出了CSS或Javascript可以使用的标识符。在css文件中(如果有的话),您将在所有标记为“view”类的元素上找到特定的样式化过程。

To find out where the URL is specified I would look in the Javascript code. It is either written directly in the same document or included from another file.

要找到URL的指定位置,我将查看Javascript代码。它可以直接写在同一个文档中,也可以从另一个文件中包含。

Search your source code for something like:

搜索您的源代码,例如:


or


and then search for any reference to your "view"-class. An included Javascript file can look something like this:

然后搜索你的“视图”类的任何引用。一个包含的Javascript文件可以是这样的:


In that case, open Javascript.js under the "include" folder and search in that file. Most commonly the includes are placed between and or close to the -tag.

在这种情况下,打开Javascript。js在“include”文件夹下,在该文件中搜索。最常见的包括在和之间或接近-tag之间。

A faster way to find the link is to search for the actual link it goes to. For example, if you are directed to http://www.google.com/search?q=html when you click it, search for "google.com" or something in all the files you have in your web project, just remember the included files.

找到链接的更快的方法是搜索它所指向的实际链接。例如,如果你被定向到http://www.google.com/search?当你点击它,搜索“google。com”或者你在你的网络项目中所有的文件,只要记住包含的文件。

In many text editors you can open all the files at once, and then search in them all for something.

在许多文本编辑器中,您可以同时打开所有的文件,然后在它们中搜索所有的内容。

#2


11  

The href is probably generated in a Javascript function. For example with jQuery:

href可能是在Javascript函数中生成的。与jQuery为例:

$(function() {
    $('a.view').attr('href', 'http://www.google.com');
});

#3


3  

Javascript may be hooking up to the click-event of the anchor, rather than injecting any href.

Javascript可能会连接到锚的点击事件,而不是注入任何href。

For example, jQuery:

例如,jQuery:

$('a.view').click(function() { Alert('anchor without a href was clicked');});

Of course, the Javascript can do anything it wants with the click event--such as navigate to some other page (in which case the href is never set, but the anchor still behaves as though it were)

当然,Javascript可以在单击事件中做任何事情——比如导航到其他页面(在这种情况下,href永远不会设置,但是锚仍然表现得像它一样)

#4


2  

Don't forget to look at the Javascript as well. My guess is that there is custom Javascript code getting executed when you click on the link and it's that Javascript that is generating the URL and navigating to it.

不要忘记查看Javascript。我的猜测是,当您点击链接时,会有自定义Javascript代码执行,而Javascript正在生成URL并导航到它。

#5


1  

It probably works with Javascript. When you click the link, nothing happens because it points to the current site. The Javascript will then load a window or an url. It's used a lot in AJAX web apps.

它可能与Javascript有关。当你点击链接时,什么都不会发生,因为它指向当前站点。然后,Javascript将加载一个窗口或一个url。它在AJAX web应用程序中经常使用。


推荐阅读
author-avatar
小白吃丸子
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有