【问题标题】:Implementing Terms and Conditions PopUp using JavaScript使用 JavaScript 实施条款和条件弹出窗口
【发布时间】:2022-07-06 00:32:03
【问题描述】:

我有以下 html 代码。

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        function myTermsandConditions(){
            var myWindow = window.open("","MsgWindow","width=200,height=200");
            myWindow.document.write("<p>This is Terms and Conditions Window. Please go through all the Terms and Conditions for your references.</p>")
        }
    </script>
</head>
<body>
    <label class="sign_agree">
        <span id="signup-termservice" class="unchecked">    
        </span>I agree to the 
        <a href="" >Terms and Conditions</a> 
        .
    </label>     
    <button onclick="myTermsandConditions()">T&C</button>
</body>
</html>

这里有一个 T&C 按钮,当我单击该按钮时,将打开一个窗口并显示使用函数 myTermsandConditions() 给出的自定义消息。 但我正在尝试对条款和条件链接实施相同的操作。根据我的要求,我不应该使用该按钮,但是当单击下面给出的条款和条件链接时,应使用 myTermsandConditions() 函数打开窗口或弹出窗口。

<a href="" >Terms and Conditions</a>

我正在努力寻找解决方案并在此过程中学习。

【问题讨论】:

标签: javascript


【解决方案1】:

您也可以在标签上添加“onclick”。

&lt;a href="#" onclick="myTermsandConditions()"&gt;T&amp;C&lt;/a&gt;

【讨论】:

    猜你喜欢
    • 2012-09-23
    • 2020-08-24
    • 2012-02-07
    • 1970-01-01
    • 2018-01-25
    • 1970-01-01
    • 2023-02-14
    • 2012-07-17
    • 1970-01-01
    相关资源
    最近更新 更多