如何使用 Prototype 隐藏亚马逊网上商店默认工具栏?

发布于 2024-08-11 18:35:28 字数 2035 浏览 3 评论 0原文

今天早上玩完后,我发现亚马逊网上商店中有一段默认的 html 代码,它将在页面顶部添加一个工具栏。 html 如下所示:

    <td id="wba_logo_bg">
<table class="logo" border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody><tr><td align="left"></td>
<td class="wba_account" style="padding: 5px;" align="right" valign="top">
<table border="0" cellpadding="0" cellspacing="0">
<form action="#" id="searchForm" method="get" name="searchForm"></form>
<tbody><tr><td class="wba_account_link">
<a xmlns:xhtml="http://www.w3.org/1999/xhtml" class="myAccountNav" href="#" onclick="return false;">home</a></td>
<td class="myAccountDots"></td>
<td class="wba_account_link"><a class="myAccountNav" href="#" onclick="return false;">view cart</a></td>
<td class="myAccountDots"></td><td class="wba_account_link"><a class="myAccountNav" href="#" onclick="return false;">my account</a></td>
<td class="myAccountDots"></td><td class="wba_account_link"><a class="myAccountNav" href="#" onclick="return false;">order status</a></td>
<td><img src="pageEditor_files/1_pixel.gif" hspace="7"></td>
<td><input name="keyword" tabindex="1" type="text"></td>
<td><img alt="Search" class="wba_search_btn" onclick="return false;" onkeyup="if (13==event.keyCode) searchForm.submit();" 
src="pageEditor_files/btn_search.gif" style="cursor: pointer;" tabindex="2" title="Search" hspace="3">
</td></tr></tbody>
</table>
</td></tr></tbody>
</table>

</td>

到目前为止,我能够使用原型来查找类名为 wba_account_link 的内容,并通过下面的代码隐藏它们:

    function hideAmazonToolbar()
{
    $("#wba_logo_bg").hide();
}//end function

但我真正想做的是最好隐藏整个 tbody,但使用我的原型技术有限,我真的不知道如何做到这一点。有人能给我指出如何完成这项工作的正确资源吗?

编辑

走得更高,显然有一个带有 id 的 td,并使用原型隐藏函数解决它!伙计,我喜欢 javascript 框架:)

after playing around this morning, i've found that there's this default chunk of html code in the amazon webstore which will add a toolbar on top of the page. the html looks like below:

    <td id="wba_logo_bg">
<table class="logo" border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody><tr><td align="left"></td>
<td class="wba_account" style="padding: 5px;" align="right" valign="top">
<table border="0" cellpadding="0" cellspacing="0">
<form action="#" id="searchForm" method="get" name="searchForm"></form>
<tbody><tr><td class="wba_account_link">
<a xmlns:xhtml="http://www.w3.org/1999/xhtml" class="myAccountNav" href="#" onclick="return false;">home</a></td>
<td class="myAccountDots"></td>
<td class="wba_account_link"><a class="myAccountNav" href="#" onclick="return false;">view cart</a></td>
<td class="myAccountDots"></td><td class="wba_account_link"><a class="myAccountNav" href="#" onclick="return false;">my account</a></td>
<td class="myAccountDots"></td><td class="wba_account_link"><a class="myAccountNav" href="#" onclick="return false;">order status</a></td>
<td><img src="pageEditor_files/1_pixel.gif" hspace="7"></td>
<td><input name="keyword" tabindex="1" type="text"></td>
<td><img alt="Search" class="wba_search_btn" onclick="return false;" onkeyup="if (13==event.keyCode) searchForm.submit();" 
src="pageEditor_files/btn_search.gif" style="cursor: pointer;" tabindex="2" title="Search" hspace="3">
</td></tr></tbody>
</table>
</td></tr></tbody>
</table>

</td>

and thus far i was able to use prototype to find those with the class name of wba_account_link and hide them via the codes below:

    function hideAmazonToolbar()
{
    $("#wba_logo_bg").hide();
}//end function

but what i really want to do is preferably to hide the whole tbody instead, but with my limited prototype skills, i don't really know how to do this. can anybody point me to the right resources on how to get this done?

EDIT

Went higher up and apparently there's a td with an id, and solve it using prototype hide function! man, i love javascript framework :)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

╄→承喏 2024-08-18 18:35:28

您需要 up 函数。我认为这应该可以做到。

document.getElementsByClassName('wba_account_link').up('tbody');

You want the up function. I think this should do it.

document.getElementsByClassName('wba_account_link').up('tbody');
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文