基于Click事件的Hubspot动态页面

时间:2019-05-24 17:12:04

标签: javascript html css web hubspot

我有一个hubspot网页,上面有10个链接,可以下载不同的数据表。目前,当我单击任何链接时,它都有单独的页面,需要填写表格。填写完表格后,它会重定向以感谢您,再次是10。

因此,我希望只有2个页面,而不是20个页面,这些页面的动态内容根据我单击的链接而变化。

我的两个HTML文件是

1)test.html

<!doctype html>
<html>
<head>
    <script type="application/javascript" src="js.js">
        </script>

<meta charset="utf-8">
<title>Links</title>
</head>


<body>

    <a href="#" id="apple" name="apple" onClick="checkclick('apple');">Apple</a><br>
    <a href="#" id="banana" name="banana" onClick="checkclick('banana');">Banana</a><br>
    <a href="#" id="carrot" name="carrot" onClick="checkclick('carrot');">Carrot</a>
</body>
</html>

2)download.html

<!DOCTYPE html>
<html>
<head>

<style>
#demo{
display: none;
background-color: yellow;
}
#demo1{
display: none;
background-color: yellow;
}

#demo2{
display: none;
background-color: yellow;
 }

 </style>

 </head>
 <body>

 <h2>My First Web Page</h2>
 <p>My First Paragraph.</p>
 <p id="demo">This is apple section</p>
 <p id="demo1">This is banana section</p>
 <p id="demo2">This is carrot section</p>
 <script type="application/javascript" src="js.js">
 </script>

 </body>
 </html> 

3)js.js

 function check(){

        document.getElementById("demo").style.display = "block";

    }

    function check1(){

        document.getElementById("demo1").style.display = "block";

    }
    function check2(){

        document.getElementById("demo2").style.display = "block";

    }


    function checkclick(a){

        if (a == 'apple'){
             window.location.href = "download.html";
             check();
        }

        if (a == 'banana'){
            window.location.href = "download.html";
            check1();
        }

        if (a == 'carrot'){
            window.location.href = "download.html";
            check2();
        }

    }

0 个答案:

没有答案