Happy Birthday Bhaiya
4 years ago by saharshjain in HTML
<!DOCTYPE html>
<html>
<body>
<button onclick="lotsOfWishes()">Me me me me first please!</button>
<p id="lotsOfWishes"></p>
<br><br>
<button onclick="FiniteWishes()">That's a lot bro!</button>
<p id="finiteWish"></p>
<br><br>
<button onclick="bumpMe()">Curiosity</button>
<p id="bumps"></p>
<br><br>
<script>
class Year {
constructor(age) {
this.feelings = ["bliss","contentment","delight","elation","enjoyment","euphoria","exhilaration","glee","joy","jubilation","laughter","optimism","peace of mind","pleasure","prosperity","well-being","beatitude","blessedness","cheer","cheerfulness","content","delectation","delirium","ecstasy","enchantment","exuberance","felicity","gaiety","geniality","gladness","hilarity","hopefulness","joviality","lightheartedness","merriment","mirth","paradise","playfulness","rejoicing","sanctity","amusing","enjoyable","entertaining","lively","pleasant","boisterous","convivial","diverting","merry","witty","affection","appreciation","devotion","emotion","fondness","friendship","infatuation","lust","passion","respect","taste","tenderness","yearning","adulation","allegiance","amity","amorousness","amour","ardor","attachment","case","cherishing","crush","delight","devotedness","enchantment","enjoyment","fervor","fidelity","flame","hankering","idolatry","inclination","involvement","like","partiality","piety","rapture","regard","relish","sentiment","weakness","worship","zeal","ardency","mad for","soft spot","appreciation","awe","consideration","deference","dignity","esteem","fear","honor","recognition","regard","reverence","tribute","account","adoration","approbation","courtesy","estimation","favor","homage","obeisance","ovation","repute","testimonial","veneration","worship"];
this.age = age;
}
wishHappyBirthday() {
var wish = ""
wish += "Wish you lot of\n";
for (var years = 1; years <= (10* this.age); years++) {
var randInt = Math.floor(Math.random()*this.feelings.length+1);
wish += " " + this.feelings[randInt]
}
return wish;
}
FiniteWishMe(){
var wish = ""
wish += "Basically wishing you lot of success, love , happiness and fun in current and coming years....";
wish += "Happy Birthday bhaiya";
return wish;
}
bumps(){
var wish = ""
wish +="And definitely " + this.age + " birthday bumps!!!!!!"
return wish;
}
}
var i = 0,j=0,k=0;
var speed = 50;
var Sarwesh = new Year(28);
var wishText = Sarwesh.wishHappyBirthday();
function lotsOfWishes() {
if (i < wishText.length) {
document.getElementById("lotsOfWishes").innerHTML += wishText.charAt(i);
i++;
setTimeout(lotsOfWishes, 10);
}
}
var finiteWish = Sarwesh.FiniteWishMe()
function FiniteWishes() {
if (j < finiteWish.length) {
document.getElementById("finiteWish").innerHTML += finiteWish.charAt(j);
j++;
setTimeout(FiniteWishes, 30);
}
}
var bumpWish = Sarwesh.bumps()
function bumpMe() {
if (k < bumpWish.length) {
document.getElementById("bumps").innerHTML += bumpWish.charAt(k);
k++;
setTimeout(bumpMe, 50);
}
}
</script>
</body>
</html>