HTMLify

index.html
Views: 259 | Author: khushi
<div id="main">
    <h1>Instagram chla rhe ho?</h1>
<button id="yes" onclick="yes()">
    Yes
</button>

<button id="no" onmouseover="changeposition()" onclick="changeposition()">
    No
</button>

</div>

<style>
    body{
        background-color: white;
    }
#no {
    position: relative;
    left: 0px;
    top: 0px;
    transition: 0.2s ease;
}
button{
    background-color:palevioletred;
    border-radius: 7px;
    height: 20px;
    width: 50px;
}
</style>


<script>
var no_button = document.getElementById("no");

function changeposition(){
    console.log(no_button.style.left);
    let r_left = Math.floor(Math.random() * 1000) % window.screen.width;
    let r_top = Math.floor(Math.random() * 1000) % window.screen.height;

    no_button.style.left = r_left + "px";
    no_button.style.top = r_top + 'px';
    //document.body.innerHTML = "working";
    console.log(window.screen.width);
    console.log(window.screen.height);
}

function yes(){
    var yeshtml = `
<h1>Mujhe pta tha,,Aree bro pdai likhai kro IAS/VAIS bno desh ko smbhalo :) </h1>
 <image height="200" width="300px" src="modi.gif "></image>   
<audio src=" Moye Moye  - MobCup.Com.Co.mp3" autoplay="true"></audio>
`;
    
    document.getElementById("main").innerHTML = yeshtml;

}


</script>

Comments