Practical 5 (BSBC-205)
<!-- Write a JavaScript code to print your name with each letter in different size and color. --> <!DOCTYPE html> <html> <head> <title>Fourth JavaScript</title> <style> p { text-align: center; } </style> </head> <body id="body"> <p id="hello"></p> <script> function rand() { var hello = document.getElementById("hello"); hello.innerHTML = ""; var name = "Ajay Bhatia"; for (var i = 0; i < name.length; i++) { var tag = '<span id="s' + (i+1) + '">' + name.charAt(i) + '</span>'; hello.innerHTML += tag; var span = document.getElementById("s" + (i+1)); var size = Math.ceil(Math.random() * 12); span.style.fontSize = size + "em"; var r = Math.ceil(Math.random() * 255); var g = Math.ceil(Math.random() * 255); va...