我无法在非零日期禁用链接 [英] I cannot disable link on non-zero date

查看:121
本文介绍了我无法在非零日期禁用链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 < tr bgcolor =<?php echo $ rowColor?> > 
< td>< font face =Arial,Helvetica,sans-serif><?php echo $ f4; ?>< /字体>< / TD>
< td>< font face =Arial,Helvetica,sans-serif><?php echo $ f5; ?>< /字体>< / TD>
< td>< font face =Arial,Helvetica,sans-serif><?php echo $ f3; ?>< /字体>< / TD>
< td>< font face =Arial,Helvetica,sans-serif><?php echo $ deliv_date; ?>< /字体>< / TD>
< / tr>
<?php
$ i ++;
}
mysql_close();

?>
< tr bgcolor =<?php echo $ rowColor?> >
< td>
< strong>总计:< / strong>
< / td>
< td colspan =1>& nbsp;< / td>
< td>< font face =Arial,Helvetica,sans-serif><?php echo $ f8; ?>< /字体>< / TD>
< / td>
< / tr>
< / table>
< / div>
< div id =footer>
< hr />
< div class =buttonwrapper>

 < a class =boldbuttonshref =<?php echo($ deliv_date!='0000-00-00')?'invoice_conf.php':'javascript:void(0)';?>> 
< span>确认快递< / span>
< / a>






或者您也可以使用 class say disabled_link ,如果你想用纯CSS防止使用 pointer-events:none; code>



演示



演示

.disabled_link {
pointer-events:none;
cursor:default;





$支持 pointer-events 在Internet Explorer中并不令人印象深刻,我建议您使用 span ,而不是像日期不是 0000-00-00 ,然后 echo span 标记,否则 echo < a>


    <tr bgcolor="<?php echo $rowColor ?>"  >
        <td><font face="Arial, Helvetica, sans-serif"><?php echo $f4; ?></font></td>
        <td><font face="Arial, Helvetica, sans-serif"><?php echo $f5; ?></font></td>
        <td><font face="Arial, Helvetica, sans-serif"><?php echo $f3; ?></font></td>
        <td><font face="Arial, Helvetica, sans-serif"><?php echo $deliv_date; ?></font></td>
    </tr>
    <?php
        $i++;
        }
        mysql_close();

    ?>
    <tr bgcolor="<?php echo $rowColor ?>"  >
        <td>
            <strong>Total:</strong>
        </td>
        <td colspan="1">&nbsp;</td>
        <td ><font face="Arial, Helvetica, sans-serif"><?php echo $f8; ?></font></td>
        </td>
    </tr>
</table>
</div>
<div id="footer">
    <hr/>
    <div class="buttonwrapper">
        <a  class="boldbuttons" href="invoice_conf.php" <?php if ($deliv_date !=  '0000-00-00') echo 'disabled="disabled"' ?>><span>confirm delivery</span> </a>
    </div>

I am trying to disable the link in the last div when there is a non-zero delivery date. As you can see in the attached screen shot, I have a non-zero delivery date. When I try the link it is not disabled. Does anyone know why this could be,

Thanks

解决方案

Adding disabled attribute won't disable the link, if you want, just echo an # instead of the real source, or with Javascript, adding javascript: void(0)

Demo

<a class="boldbuttons" href="<?php echo ($deliv_date != '0000-00-00') ? 'invoice_conf.php' : 'javascript: void(0)'; ?>">
    <span>confirm delivery</span>
</a>


Or you can also use a class say disabled_link and if you want to prevent with pure CSS than use pointer-events: none;

Demo

Demo (Can also use lighter shades to indicate that the link is disabled)

.disabled_link {
    pointer-events: none;
    cursor: default;
}


Support for pointer-events is not impressive when it comes to Internet Explorer, I would suggest you to use span instead, like if the date is not 0000-00-00, then echo the text in span tags, else echo <a>

这篇关于我无法在非零日期禁用链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆