简体   繁体   中英

How To Add Javascript To HTML Button

I want my aweber optin to popup on the same page when you click the button right now I am using the a href which takes you to new page but I want it that when you click the button it must popup on the same page.

Aweber gives you a Javascript or Raw HTML or Link( which is what I am using now)

I have tried to save the Javascript as a .js file a call it with a onClick event but cant get it to work.

Here is my button code as it currently works with the link and opens in new page:

 <div class="send-button"> <a class="cta__btn role-element leadstyle-link" href="MY AWEBER LINK">CLICK HERE TO APPLY &#187;</a> </div> 

Here is the Javascript:

 <div class="AW-Form-493252358"></div> <script type="text/javascript">(function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) return; js = d.createElement(s); js.id = id; js.src = "http://forms.aweber.com/form/58/493252358.js"; fjs.parentNode.insertBefore(js, fjs); }(document, "script", "aweber-wjs-pklekkdj5")); </script> 

You can try this:

<script type="text/javascript">
function doSomething(){
    // ...
}
</script>

<a href = "#" onClick="doSomething">Button</a>

您可以使用awf_Form_.showForm();强制显示AWeber灯箱表单awf_Form_.showForm();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM