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:

<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Find and replace with blink</title>
<style>
.blink {
  animation: blink 1s steps(5, start) infinite;
  -webkit-animation: blink 1s steps(5, start) infinite;
}
@keyframes blink {
  to { visibility: hidden; }
}
@-webkit-keyframes blink {
  to { visibility: hidden; }
}
</style>
</head>

<body>
<script>
String.prototype.replaceAll = function (find, replace) {
    var str = this;
    return str.replace(new RegExp(find.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&'), 'g'), replace);
};

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?";
str=str.replaceAll("HOTEL","<span class='blink'>CAFEE</span>");
document.write(str);

</script>
</body>
</html>
Sir Thank you very mutch.
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Simple Web Ticker - By Mohadmmad Towhidul Islam</title>
<script>
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' /> "];

var inc=0 
function changetext(){
	if (!document.getElementById) return	
	document.getElementById("output").innerHTML=lines[inc];	
	inc++
	if(inc>=lines.length)inc=0;
    fadingtext()
    setTimeout("changetext()",4000)
}

//---fadeingtext()------
hexinput=255
function fadingtext(){	         	
	if(hexinput>0) {	
		hexinput-=11; 
		document.getElementById("output").style.color="rgb("+hexinput+","+hexinput+","+hexinput+")";
		setTimeout("fadingtext()",20);	
	}else{
	    hexinput=255 
	} 
}
</script>

</head>
<body onLoad="changetext()">
<div id="output"></div>
</body>
</html>
Sir i am very glad to you for the solution of my problem.
About Author
MD. AIUB ALI
Copyright © 2024. Powered by Intellect Software Ltd