Home  • Programming • JavaScript

suppose on a first time writing a HOTEL will show (blink) after going that writing a CAFEE will replace.how can do that using by javascript?

Comments 6


Here is your code:

  1. <!DOCTYPE HTML>
  2. <html>
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  5. <title>Find and replace with blink</title>
  6. <style>
  7. .blink {
  8. animation: blink 1s steps(5, start) infinite;
  9. -webkit-animation: blink 1s steps(5, start) infinite;
  10. }
  11. @keyframes blink {
  12. to { visibility: hidden; }
  13. }
  14. @-webkit-keyframes blink {
  15. to { visibility: hidden; }
  16. }
  17. </style>
  18. </head>
  19.  
  20. <body>
  21. <script>
  22. String.prototype.replaceAll = function (find, replace) {
  23. var str = this;
  24. return str.replace(new RegExp(find.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&'), 'g'), replace);
  25. };
  26.  
  27. str="suppose on a first time writing a HOTEL will show (blink) after going that writing a CAFEE will replace.how can do that using by javascript?";
  28. str=str.replaceAll("HOTEL","<span class='blink'>CAFEE</span>");
  29. document.write(str);
  30.  
  31. </script>
  32. </body>
  33. </html>
Sir Thank you very mutch.
  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>Simple Web Ticker - By Mohadmmad Towhidul Islam</title>
  6. <script>
  7. lines=["<img src='http://vcampus.co/media/image/original/3372.jpg' width='300' /> <br/> Welcome to <strong>VCampus</strong>","This is a <strong>Virtual Learning Community</strong>","Enjoy your stay here <img src='http://vcampus.co/images/emotions/yahoo_emotions/1.gif' />","<h1>শুভ নববর্ষ ১৪২১</h1> <img src='http://vcampus.co/media/image/original/609.jpg' width='300' /> "];
  8.  
  9. var inc=0
  10. function changetext(){
  11. if (!document.getElementById) return
  12. document.getElementById("output").innerHTML=lines[inc];
  13. inc++
  14. if(inc>=lines.length)inc=0;
  15. fadingtext()
  16. setTimeout("changetext()",4000)
  17. }
  18.  
  19. //---fadeingtext()------
  20. hexinput=255
  21. function fadingtext(){
  22. if(hexinput>0) {
  23. hexinput-=11;
  24. document.getElementById("output").style.color="rgb("+hexinput+","+hexinput+","+hexinput+")";
  25. setTimeout("fadingtext()",20);
  26. }else{
  27. hexinput=255
  28. }
  29. }
  30. </script>
  31.  
  32. </head>
  33. <body onLoad="changetext()">
  34. <div id="output"></div>
  35. </body>
  36. </html>
Sir i am very glad to you for the solution of my problem.
About Author
MD. AIUB ALI
Copyright © 2025. Powered by Intellect Software Ltd