在Mac和iPhone的Safari浏览器中无法单击“提交”按钮

Submit button can not be clicked in Safari browser of Mac and iPhone

本文关键字:单击 提交 按钮 Mac iPhone 浏览器 Safari      更新时间:2023-09-26

以下代码在除mac电脑和iphone上的Safari浏览器外的所有浏览器中都能正常工作。按钮显示正确,但用户无法点击提交按钮(点击按钮时不会提交表格)在Safari浏览器中进行投票。

请告知我需要对代码进行什么类型的更改,以便它在Safari浏览器中也能像所有其他浏览器一样工作。

Javascript

<script language="JavaScript" type="text/javascript">
function confirm_vote()
{
    with(document.frm_vote)
    {
        if(isEmpty(trim(txt_code.value)))
        {
            alert("Captcha missing!!!");
            txt_code.select();
            txt_code.focus();
            return false;
        }
        if(confirm("Are you sure you want to vote for this product?"))
        {
            if(confirm("Confirmation: Click 'Ok' to vote for this product or 'Cancel' to cancel."))
            {
                return true;
            }
        }
        return false;
    }
}
</script>

HTML&PHP

<form action="m_voteforme_p.php" method="post" id="frm_vote" name="frm_vote" onSubmit="return confirm_vote();">
<table border="0" cellspacing="0" cellpadding="0">
    <tr><td>Captcha:&nbsp;* <input type="text" name="txt_code">&nbsp;&nbsp;<img src="./inc/get_unique_image.php" border="0"></td></tr>
    <tr>
        <td>
            <input type="submit" id="voteforme" name="voteforme" value="Vote For Me">
            <input type="hidden" name="hdn_mpkid" value="<?php print($rs_m_voteforme->fields("mpkid")); ?>">
        </td>
    </tr>
</table>

单击提交按钮后,能否确保它是否进入您的confirm_vote?我将您的代码复制到我的本地文件中,并尝试使其达到我在if(isEmpty(trim(txt_code.value)))中设置的断点,这意味着函数被调用,但我的代码中缺少函数isEmpty,因此无法继续执行。