【问题标题】:Rollover in Form表格翻转
【发布时间】:2014-04-03 08:39:11
【问题描述】:

我在我们的待定站点上有一个由样式化超链接组成的导航栏。

其中一个 href 最初是 PayPal 链接,但出于安全考虑,我不得不将此 PP 链接设为加密按钮。

问题是我应用于链接的悬停图像交换效果不适用于表单图像。我已经尝试了每一种方式(this.src 到 that.src,基于移动的背景位置悬停)来实现这一点,但是形式的复杂性与 href 的简单性证明是有问题的。

鉴于我下面的代码,任何人都可以向我展示一种非 Javascript 方式来移动“pp3.gif”的位置或交换其他两个图像以模仿我已经为其他列表元素提供的 css 悬停图像交换

    <li><a href="info.htm" target="iframe1">Information</a></li>
    <li>
        <form action="https://www.paypal.com/cgi-bin/webscr" method="post">
           <input type="hidden" name="cmd" value="_s-xclick">
           <input type="image" src="../buttons/pp3.gif" name="submit">
           <input type="hidden" name="encrypted" value="-----BEGIN PKCS7 ... END PKCS7-----">
       </form>
    </li>
    <li><a href="delivery.htm" target="iframe1">Livraison</a></li>

谢谢! 戴夫

【问题讨论】:

    标签: html css paypal


    【解决方案1】:

    我建议不要使用&lt;input type="image"&gt;。与直接使用 CSS 设置输入样式相比,它非常不灵活。试试这个:

    http://jsfiddle.net/6S8Hs/

    <ul>
    <li><a href="info.htm" target="iframe1">Information</a></li>
    
    <li>
        <form action="https://www.paypal.com/cgi-bin/webscr" method="post">
            <input type="hidden" name="cmd" value="_s-xclick"/>
            <input class="hover-effect" type="submit" name="submit"/>
            <input type="hidden" name="encrypted" value="-----BEGIN PKCS7 ... END PKCS7-----"/>
        </form>
    </li>
    <li><a href="delivery.htm" target="iframe1">Livraison</a></li></ul>
    

    ul{ list-style-type: none; }

    ul li{ display:inline; float:left; margin-left:10px; }

    .hover-effect{ width:50px; height: 50px; background-image:url("http://a.deviantart.net/avatars/t/o/toaster-kitten.jpg"); display:block; border:none; color:transparent; }

    .hover-effect:hover{ background-image:url("http://img.ehowcdn.com/other-people/ehow/images/a06/27/bh/care-newborn-kitten-mother-800x800.jpg"); }

    【讨论】:

    • 谢谢你,成功了。我的 css 文本非常相似,但是您关于删除 并将其替换为 Class 的指导消除了混淆。将 style="cursor:pointer" 添加到 Input 标签将我的箭头指针变成手形指针,使我的安全 PayPal 按钮看起来像导航栏中的所有其他超链接 - 非常感谢。但是,我不清楚列表代码中提到的“错字”,或者对关闭输入标签的引用。这里到底有什么遗漏或错误?
    • 您的问题已被其他用户编辑,但之前&lt;li&gt; 的结束标记拼写为&lt;il&gt;。关于输入标签的评论实际上是不正确的,对不起。我删除了它。使用 HTML5,它们不需要关闭。所以你可以忽略它:)
    • 感谢您对代码拼写错误的提醒 - 已修复!
    猜你喜欢
    • 2019-12-29
    • 1970-01-01
    • 2021-10-27
    • 2020-09-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-09-27
    • 2017-01-15
    相关资源
    最近更新 更多