1
fsCreditCard.Visible = false;

在一些代码隐藏的 c# 代码中工作以隐藏在 .aspx 代码中定义的字段集 fsCreditCard,如下所示:

<fieldset id="fsCreditCard" runat="server" visible="false">
    <legend>Credit Card</legend>
        <ul style="margin:50px;font-size:16px;">
            <li>
                <u><b><a href="javascript:OpenPaymentWindow(); fsCreditCard.Visible= false; fsAfterCreditCard.Visible = true; fsPaymentOptions.Visible=false;">Click here</a></b></u> now to open the PayPal payment window and complete your payment. If you have any trouble, please make sure any pop up blockers are disabled and reload this page.<br /><br />
            </li>
        </ul>
</fieldset>

现在,当用户单击超链接“单击此处”时,实际上处理了“OpenPaymentWindow”,但“fsCreditCard.Visible= false; fsAfterCreditCard.Visible = true;" 命令没有完成。它们似乎不是 javascript 命令,它们存在于 C# 代码的其他地方。你有什么建议?

4

1 回答 1

1

将显示/隐藏元素的逻辑移动到OpenPaymentWindowJavaScript 函数中并使用 jQuery 选择器,如下所示:

function OpenPaymentWindow() {
    // Logic to open payment window here

    // Show/hide DOM elements here
    $('#fsCreditCard').hide();
    $('#fsAfterCreditCard').show();
    $('#fsPaymentOptions').hide();
}
于 2013-11-08T05:43:00.117 回答