谷歌会索引表单内的按钮单击吗?

Will google index a button click inside a form?

本文关键字:按钮 单击 索引 表单 谷歌      更新时间:2023-09-26

我向我建议了以下代码。我的问题是问谷歌是否会对此进行索引。

<form style="display: inline" action="http://example.com/" method="get">
  <button>Visit Website</button>
</form>

我还有哪些其他选择?对我来说,保留按钮小部件查找链接很重要。以前我使用了以下内容,但被告知这不是一个好主意:

<a href="www.stackoverflow.com">
   <button disabled="disabled" >ABC</button>
 </a> 

我认为按钮点击事件还有另一种选择,但我不确定如何编码以及是否会在 Google 上索引。 我也在网页上使用jQuery,并将其作为一个选项。

然而,最重要的是,我被告知我必须使用"按钮"小部件,以便按钮看起来与页面上的其他按钮相同。

谢谢

它不会索引表单标记的操作。 如果您尝试保留外观,则可以对按钮的图像执行以下操作:

<a href="www.stackoverflow.com" title="visit stackoverflow"><img src="button.jpg" title="button" alt="button" '></a>

您可以使用普通的<a href>链接并设置其样式,并且所有<button>看起来与CSS相同:

<!doctype html>
<style>
    button, input[type=submit], .btn {
        color: black;
        text-decoration: none;
        font-weight: normal;
        padding: 3px;
        border: 2px outset #000;
        -webkit-border-radius: 3px;
        -moz-border-radius: 3px;
        border-radius: 3px; 
        background: rgb(232,232,232); /* Old browsers */
        background: -moz-linear-gradient(top, rgba(232,232,232,1) 0%, rgba(229,229,229,1) 44%, rgba(204,204,204,1) 71%, rgba(216,216,216,1) 100%); /* FF3.6+ */
        background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(232,232,232,1)), color-stop(44%,rgba(229,229,229,1)), color-stop(71%,rgba(204,204,204,1)), color-stop(100%,rgba(216,216,216,1))); /* Chrome,Safari4+ */
        background: -webkit-linear-gradient(top, rgba(232,232,232,1) 0%,rgba(229,229,229,1) 44%,rgba(204,204,204,1) 71%,rgba(216,216,216,1) 100%); /* Chrome10+,Safari5.1+ */
        background: -o-linear-gradient(top, rgba(232,232,232,1) 0%,rgba(229,229,229,1) 44%,rgba(204,204,204,1) 71%,rgba(216,216,216,1) 100%); /* Opera11.10+ */
        background: -ms-linear-gradient(top, rgba(232,232,232,1) 0%,rgba(229,229,229,1) 44%,rgba(204,204,204,1) 71%,rgba(216,216,216,1) 100%); /* IE10+ */
        filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#e8e8e8', endColorstr='#d8d8d8',GradientType=0 ); /* IE6-9 */
        background: linear-gradient(top, rgba(232,232,232,1) 0%,rgba(229,229,229,1) 44%,rgba(204,204,204,1) 71%,rgba(216,216,216,1) 100%); /* W3C */
        cursor: default;
    }
    button:hover, input[type=submit]:hover, .btn:hover {
        background: #eee;
    }
    button:active, input[type=submit]:active, .btn:active {
        border: 2px inset;
    }
</style>
<form action="http://www.example.com" method="get">
<button>This is a button</button>
<a class="btn" href="http://www.example.com">This is a link</a>
<input type="submit" value="This is a submit button">
</form>

这将使<button>和与类的链接看起来几乎相同.btn。 唯一明显的区别是,元素在具有焦点时收到的outline显示在"真实"按钮内部和链接外部周围。

我想

你想问谷歌网络爬虫是否会抓取(关注(该链接。我真的不知道,但我希望它会。但是,如果没有,您可以随时使用:

<a style="display:none;" href="www.stackoverflow.com" />

它会抓取它(至少在我的一些页面上是这样(。

Google 不会提交表单来索引您的网站。

但是,既然您想要的只是保留该外观,为什么不在页脚或导航中仅链接到您网站的其余部分呢?您甚至可以向Google提交站点地图。或者只是提交网址:http://www.google.com/addurl/?continue=/addurl