简体   繁体   中英

On click link popup javascript

I want a pop up on a link on my website. I want the pop having following code

<script data-cfasync=false src="//s.ato.mx/p.js#id=8135&type=popup&size=800x600&hourscap=1"></script>

and my link for example

`<a href="page.php">Click Me</a>`

I want when someone click on the click me link the pop up appears. also kindly tell me how can i add pop up on the scroll bar.

I am in learning stage. kindly guide me

save the following code as .html or .php file without making any changes

<!DOCTYPE html>
<html>
<head>
<title>POPUP Demo</title>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script>
        $(function(){ 
          $("#btn").click(function(e){
              e.preventDefault();
              var newWindow = window.open("", "newWindow", "width=700");
              newWindow.document.write("<p>content of popup window</p><code>echo '<b>echo php</b>';</code>");
          });
        });
    </script>
</head>
<body>
    <a href="#" id="btn">Click me</a>
</body>
</html>

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