Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <title></title>
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <style>
- .myButton {
- box-shadow: 0px 10px 14px -7px #276873;
- background:linear-gradient(to bottom, #599bb3 5%, #408c99 100%);
- background-color:#599bb3;
- border-radius:8px;
- display:inline-block;
- cursor:pointer;
- color:#ffffff;
- font-family:Arial;
- font-size:20px;
- font-weight:bold;
- padding:13px 32px;
- text-decoration:none;
- text-shadow:0px 1px 0px #3d768a;
- }
- .myButton:hover {
- background:linear-gradient(to bottom, #408c99 5%, #599bb3 100%);
- background-color:#408c99;
- }
- .myButton:active {
- position:relative;
- top:1px;
- }
- </style>
- <script>
- function ready(callback){
- // in case the document is already rendered
- if (document.readyState!='loading') callback();
- // modern browsers
- else if (document.addEventListener) document.addEventListener('DOMContentLoaded', callback);
- // IE <= 8
- else document.attachEvent('onreadystatechange', function(){
- if (document.readyState=='complete') callback();
- });
- }
- ready(function(){
- createBtn("Click Me","test","main","cl");
- createBtn("Click Me too","test2","main","cl");
- createBtn("Click Me As Well","test2","main2","cl2");
- });
- let cl2 = function(e){
- e.innerHTML=Date();
- }
- let cl = function(e){
- console.log(e.innerHTML);
- alert(e.innerHTML);
- };
- function createBtn(label,id,div,func){
- let btn = '<a href="#" onclick="'+func+'(this);" id="'+id+'" class="myButton">'+label+'</a>';
- document.getElementById(div).innerHTML+=btn;
- }
- </script>
- </head>
- <body>
- <div id="main"></div>
- <div id="main2"></div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement